-
▼
2011
(334)
-
▼
March
(22)
- How to Import Posts From Another WordPress Blog
- How to Build Websites With WordPress
- How to Make Columns in Wordpress
- How to Insert Photo Galleries Into Wordpress
- How to Change the Favicon on Genesis WordPress
- How to Use Fonts on Wordpress
- How to Remove a Category from WordPress Permalinks
- How to Update Existing WordPress Tags
- How to Combine Separate WordPress Themes
- How to Add an MP3 Player to a WordPress Blog
- How to Display Articles in a Wordpress Template
- How to Add a Twitter Stream to WordPress
- How to Publish Tweets to WordPress
- How to Use Short Code in Wordpress
- How to Change Post Types on WordPress
- How to Put an Icon in the Address Bar on a WordPre...
- How to Switch Domains From WordPress to GoDaddy
- How to Reference the WordPress Database
- How to Move the URL of a WordPress Blog
- How to Add a Highlight Box to a Wordpress Post
- How to Insert a Bookmark in a WordPress Post
- How to Block an IP Address from Wordpress
-
▼
March
(22)
adsense
How to Reference the WordPress Database
1. Globalize the '$wpdb' variable before using it, using the following code:global $wpdb;
2. Write out the query or function that you want to run on your WordPress site. For now, just leave a gap at the point you need to reference the tables.
3. Fill in your gap with the relevant reference. For the Posts table, use '$posts'; for Meta Content, use '$postmeta'; for the Comments table, use '$comments'; for the additional comment information, use '$commentmeta'; for the Terms table which holds the descriptions of categories and tags, use '$terms'; for the Term_taxonomy table which holds the categories and tags, use '$term_taxonomy'; for the Users table, use '$users'; for the Usermeta table which contains nicknames, descriptions and permissions of registered users, use '$usermeta'; for the Links table, use '$links'; and for the Options table, use '$options.'
4. Add the opening '
' -- without quotes -- php tags if you have not already done so.
5. Run your code and check whether it works correctly. If the query isn't working, turn error echoing on to help you troubleshoot and fix errors in your code. To turn error echoing on, use this line of code:
show_errors(); ?>To turn error echoing off completely, simply remove the above line. To turn it off at a certain point in the code, use the following line:
hide_errors(); ?>You can then turn it back on later if needed. You can also print the errors generated by a query with the following line:
print_error(); ?>This prints the error of the most recent query.
5:28 AM | Filed Under | 0 Comments
Comments
Popular Posts
-
1. Log in to your Weebly account. 2. Click 'Theme Editor.' 3. Click on the 'Design' tab. 4. Select 'Edit CSS/HTM...
-
1. Sign up for a publisher account at Bidvertiser. Submit basic contact information and confirm your email address to get started. 2. Lo...
-
1. Log in to your WordPress dashboard. 2. Open the 'Appearance' section on the left side of the WordPress dashboard and then cli...
-
1. Open your WordPress Dashboard in your preferred browser. It is accessed at the '/wp-admin' location of your site. For example, ...
-
Facebook Widget 1. Create a Facebook fan page for your blog, if you don't already have one. You will have to manually share content wi...
-
1. Download and install the WordPress for BlackBerry app via BlackBerry App World. Download the version that corresponds with your BlackBe...
-
1. Go to your WordPress blog's administrative control panel. 2. Click the 'Settings' button on the left-side navigation menu...
-
1. Click the 'Add Contact' button on the 'Add New Post' page. This opens the 'Add a Contact Form' page. 2. Click...
-
1. Register an account with Amazon Web Services Cloud. If you have an existing Amazon account, enter your email address in the appropriate...
-
1. Log into your WordPress.com account using your user name and password. 2. Hover your cursor over the 'My Blogs' tab at the to...
Post a Comment