- Recent
- Popular
- Tags (0)
- Subscribers (5)
- How to: disable search engine indexing on a single postToday
-
To achieve, first get the ID of the post you’d like to be not indexed by search engines. In this exemple, I assume your post id is 17.
<?php if ($post->ID == 17) { echo '<meta name="robots" content="noindex">'; }
Open your header.php file and paste the following code between the <head> and </head> tags:That’s all. Pretty useful if you don’t want some infos to be accessible from search engines!
Note that it is possible to do something better by using custom fields. If you’re interested about this second method, just leave a comment and I’ll write a recipe!Get 20% off on the MyHomePro Premium WordPress Theme by using this exclusive code: wpcats20.
- How to: Remove /category/ from your WordPress urlYesterday
-
By default, WordPress category permalinks are displayed that way:
http://www.catswhocode.com/blog/category/wordpressAs 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/(.+)$ http://www.yourblog.com/$1 [R=301,L]Once saved, your categories pages will be displayed like this:
http://www.catswhocode.com/blog/wordpressBetter, isn’t it?
Get 20% off on the MyHomePro Premium WordPress Theme by using this exclusive code: wpcats20.
- How to: Create a tag page on your WordPress blogJanuary 7
-
To create your tag page, the first thing to do is to create a page template. Follow theses simple steps if you don’t know how to create one.
Once done, paste the following code in it:
<h2>All tags</h2> <?php wp_tag_cloud('number=0'); ?>That’s simple as that! The number=0 parameter specifies that you want to display all tags.
Get 20% off on the MyHomePro Premium WordPress Theme by using this exclusive code: wpcats20.
- How to: Create a “Logout” button on your WordPress blogJanuary 6
-
To create a “Logout” link on your WordPress blog, simply paste the following code on your theme:
<a href="<?php echo wp_logout_url(); ?>">Logout</a>Please note that this will work with WordPress 2.7+ only. If you haven’t switched to WP 2.7 yet, the following code will do (almost) the same job:
<a href="/wp-login.php?action=logout">logout</a>Get 20% off on the MyHomePro Premium WordPress Theme by using this exclusive code: wpcats20.
- How to: get the list of post that have no tags yetJanuary 5
-
To get the list of un-tagged posts, simply paste this custom loop anywhere or your theme, or use a page template. This loop will only show posts that haven’t been tagged yet.
<?php query_posts('orderby=title&order=asc&showposts=-1'); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php $tag = get_the_tags(); if (!$tag) { //Theses posts have no tags the_title(); } endwhile; endif; ?>That’s all. Now, you can easily find which posts have no tags yet, and tag them!
Get 20% off on the MyHomePro Premium WordPress Theme by using this exclusive code: wpcats20.
