How to Redirect your 404 page to the Home Page in WordPress?

Go to the root of your template, check if there is 404.php or not. If you can not find this file, just create one, then edit  404.php, add the following code: <?php header(“HTTP/1.1 301 Moved Permanently”); header(“Location: “.get_bloginfo(‘url’)); exit(); ?> Done! Simple ? Yes! I have tested the code for

Remove all links in a post content of wordpress

Edit functions.php,  add the following code: add_filter(‘the_content’, ‘removelink_content’,1); function removelink_content($content = ”) { preg_match_all(“#<a(.*?)>(.*?)</a>#i”,$content, $matches); $num = count($matches[0]);for($i = 0;$i < $num;$i++){ $content = str_replace($matches[0][$i] , $matches[2][$i] , $content); } return $content; }

Get Next / Prev 3 Posts in Relation to Current Post of WordPress

I have 7 prescription eyeglasses posts, like this: 1 – How to buy eyeglasses online? 2 – Why so many people buy prescription glasses online? 3 – How come it saves so much shopping glasses online? 4 – this is the current post 5 – Do you know the importance of prescription sunglasses? 6 – […]

Creating Multiple Single Posts for Different Categories

If each post only belongs to one category, and each category has different post template, just modify single.php, we can use the following code: if ( in_category(‘fruit’) ) { include ‘single-fruit.php’; } elseif ( in_category(‘vegetables’) ) { include ‘single-vegetables.php’; } else { // Continue with normal Loop if ( have_posts() ) : while ( have_posts() […]

How to Change the “page” slug in Pagination of WordPress?

When pagination of is activated, the pagination URL will display as “” as default. How can we change the pagination to “”?

How to Let X-Cart Display latest WordPress Posts?

This mod assumes that you use the WordPress blogging software and uses the same database as your xcart software. If your wordpress and x-cart use separate database then use this code for blog_headlines.php

Adding custom text to bottom of all posts in particular category

If we want to add the same piece of custom text to the bottom of every post in a certain category of wordpress. How do then? For example, we want to add “Good idea if you buy eyeglasses online!” at each page of category which category id is 2. Try to add the following code […]

Let WordPress Different Category Shows Different Style

For example, we are designing a company site using wordpress, 2 categoris: product category, and new category. How to let these 2 categories show different styles? Creat 2 php files: product.php, news.php, and copy all contents from wp-content/themes/zeecompany/archive.php; Edit wp-content/themes/zeecompany/archive.php, delete all contents in archive.php, and copy the following code in archive.php:

WordPress Twenty Twelve change Continue reading to post title

The default template of Twenty Twelve shows “Continue reading” at homepage, or category page. How to change “Continue reading” to post title? Edit content.php, this file is just under the template of “Twenty Twelve”, find the following code: <?php the_content( __( ‘Continue reading <span>&rarr;</span>’, ‘twentytwelve’ ) ); ?> and change it to:   <?php the_content( __( […]

Remove Any Unnecessary Files of WordPress

How can we remove the /wp-includes/js/comment-reply.js?ver=20090102 script tag? 2 steps: first edit wp-includes/functions.php, add the follow code at the end of functions.php: function clean_header(){ wp_deregister_script( ‘comment-reply’ ); } second, edit wp-includes/default-filters.php, add the next line at proper place: add_action(‘init’,’clean_header’);