Create a Scroll to top link on your WordPress blog

January 13, 2009

When you finished to read a blog post it can be very boring to scroll back to top manually. In order to enhance your blog navigation and usability, here’s a article to create a simple – but useful – way for your reader to scroll back to top in a second. First, open header.php and verify that you have a <div id=”header”> somewhere. This should be the case on more than 95% of blogs anyways. Open footer.php (or any other file) and insert the following code where you want your link to appear: <a href="#header">Scroll... [Read the full story]

Adding A Private Page Into The Navigation menu

January 11, 2009

If you use pages which have the state private, they will not be shown in the navigation. Nevertheless it can make sense to show this specific page in the navigation, if you want to provide easy access to this page for your users. The page should only appear to privileged users for sure. I will show you a little hack, which will let you exactly do this. simply open the file where your navigation is (You can look up for the wp_list_pages() function) and insert this snippets instead of the function: <ul> <?php wp_list_pages('depth=1&title_li=0&sort_column=menu_order'); if(current_user_can('read_private_pages'))... [Read the full story]

Enlight searched text in wordpress search results

January 10, 2009

Many WordPress users find the search function a bit imcomplete. For exemple, it don’t automatically hightlight the searched text. Open your search.php file and find the the_title() function. Replace it with the following: echo $title; Now, just before the modified line, add this code: <?php $title = get_the_title(); $keys= explode(" ",$s); $title = preg_replace('/('.implode('|', $keys) .')/iu', '<strong class="search-excerpt">\0</strong>', $title); ?> Save the search.php file and open style.css.... [Read the full story]

Disable search engine indexing on a single wordpress post

January 10, 2009

Most of the time, you want your posts to be indexed by search engines as such as Google as soon as possible. But if for some reason, you don’t want a particular post to be indexed by search engines. first get the ID of the post you’d like to be not indexed by search engines. In this exemple, We assume your post id is 18. Open your header.php file and paste the following code between the <head> and </head> tags: <?php if ($post->ID == 18) { echo '<meta name="robots" content="noindex">'; } That’s... [Read the full story]

Remove category from your WordPress url

January 8, 2009

Ever wanted to be able to finally remove the useless /category/ from your WordPress categories permalinks? If yes, read on and get ready to hack your .htaccess file. By default, WordPress category permalinks are displayed that way: As you can see, the category in the url is pretty useless. Here’s how to remove it: First backup your .htaccess file. Then, open it and append the following line: RewriteRule ^category/(.+)$$1 [R=301,L] Once saved, your... [Read the full story]