There is an easy way to create a custom page for a particular page using Wordpress that doesn't involve adding custom page ID checking code. This might be useful if you want to remove certain aspects of the theme (like a side menu) just for that page. The way this is done is by using the Template Name tag in the following manner.
If for some reason you can't remember your Wordpress password and you can't use the "lost your password" function that comes with Wordpress, due to problems with email, then you can use the following SQL command to reset your password.
UPDATE wp_users SET user_pass = md5('newpassword') WHERE user_login = 'admin';
This can be useful if you have a local web server that you are trying things out on before they go live on the Internet. These servers often don't have access to email as they are just testing platforms and will therefore fail if you try to use the "lost your password" function.
This command has been tested on Wordpress version 2.6.2.
I have previously talked about enable custom field search in Wordpress, but that involved altering the main Wordpress files, which is a big no-no.
So is there an alternative? Well, yes, otherwise I wouldn't have bothered writing the post! To enable custom field (also called Wordpress metadata) searching you need to set up two things.
First you need to have created a custom field (or two) and added this to a number of posts.
Next, you need to have a custom search form that has the name of the field set as the name of an input box. You don't even need the normal s input box that Wordpress uses as default.
Open up your template functions.php file and add in the following three lines of code.
If you want to display a Wordpress front page in a new or interesting way by splitting the categories into sections, or by not displaying certain categories at all then you can use the query_posts() function. This function comes as part of Wordpress and allows you to override the queries that are being executed behind the scenes. This basically controls what posts are seen by "the loop". In order for the function to work it must be called before "the loop", look out for this line (or similar):
When adding a search form to your Wordpress blog you will want to have control over what sort of form is displayed. It is possible to override the search form created by the widget function without having to go into the /wp-includes/widget.php file and editing the wp_widget_search function. Here is the function that is present in Wordpress 2.6.
If you are setting up a Wordpress blog the chances are that you will be looking into modifying the default theme to be something a little more customised to your site. Theme development can be as complicated or as simple as you want, or are capable of doing.
Wordpress themes are stored in the folder wp-content/themes/, each theme being stored in it's own directory.
The basic theme must contain two basic files, the main control is done from a file called index.php and a file called styles.css, which is also needed to allow you to display the theme within the admin section of Wordpress. If you don't want to use the styles.css file then this is fine, but it should be present and contain the following lines.
The preview mode in Wordpress exists to allow you to see how a post will look before you publish it to your site. This is an important feature if you have lots of readers as once your click that publish button your post will be live and your RSS feed will be pinged out to lots of different services. Previewing a post can avoid embarrassing spelling or formatting errors before the post goes live.
Preview uses the same templates files as your blog and so will load all of the same files as if you normally view your site. The only small issue with this mechanism is that any analytics code you might have installed will be run as well and you might see that you most visited pages are you previewing posts before putting them live.
Of course you could just filter out your IP address in your analytics, but if your Wordpress blog has lots of different authors writing content from many different locations it is unfeasible to continuously edit your analytics settings.
Wordpress has a neat little feature that allows you to write a post and then schedule it to display at some point in the future. This seems good, but it invariably doesn't work on some server platforms and rather than publishing a post Wordpress just counts the amount of time passed since it was supposed to go live. The basic solution to this is to go into the post and click on publish, which can be a pain if you are taking a couple of days off from blogging and want to leave it running.
The problem lies with the functions that convert a scheduled post into a live post which are kept in the file wp-cron.php in the root Wordpress directory. For some reason the Wordpress developers decided to call the scheduling functions using the fsockopen() function available in PHP. This essentially opens a browser session to the wp-cron.php file, just as you would if you browsed to the location using your web browser.
Looking at the code behind Wordpress there are several classes that it uses to accomplish certain things. For example, Wordpress uses the IXR class from Incutio as a XML-RPC server/client. Doing this saves the Wordpress developers from re-writing things that other people have written so that they can concentrate on the important things.
A good security tip when installing your Wordpress blog is to change the database table prefix, the idea is that this will hide the tables from any hackers looking to compromise your blog. This can be done in the wp-config.php file and the variable $table_prefix. Changing this value from the default wp_ to, for example, blog_ will change the table wp_posts to blog_posts, making it more difficult for hackers to find it. Using blog_ is only an example, you should treat the prefix like a password, include letters and numbers to make it more difficult to find.
But what happens if you have installed your system and want to change the prefix? Well you need to change the $table_prefix variable in your wp-config.php file and alter the tables in your Wordpress database. Which one you do first is up to you, but you should go them both as fast as you can. Here are some MySQL statements that should help you to do this.