How To Set Up Wordpress Custom Posts And Display On Page And Post

By // No comments:
I couldn’t find any simple guides on how to set up custom posts and display them on the archives page and on single posts.

Custom posts are necessary if you want to display two different types of posts in the same wordpress installation.

E.g. suppose you have a site which has posts about movies. The template will be designed to set out information relevant to movies such as the actors’ names, the storyline, etc, etc.

If you want to write a series of posts on another subject, say cooking, using the template files that are used for movies will obviously not work.

This problem can be easily resolved by the use of custom posts.

Step 1: Install a customs post plugin:

The two most popular plugins are “WCK - Custom Fields and Custom Post Types Creator” and “Custom Post Type UI”.

I am using WCK - Custom Fields and Custom Post Types Creator for this demo.

Step 2: Go to WCK > Post Type Creator.

Create a post type called “articles”. Give it the singular label ‘article’ and the plural label “articles (you can choose any other name you want but remember to use that name in the template files as well).

Under "supports", you can leave it at default or choose any or all of the options. I chose "excerpt". You can come back later and change the options.

Clicking the “add entry” button will create an “articles” menu on the left side. Go there and add two articles called articles 1 and articles 2 with some arbitrary text in them. Open the articles to ensure that you are able to view them. If there is a 404 'not found' problem, it is probably because of a permalinks problem. Go to Settings > Permalinks and refresh the permalinks. You can also change the permalinks to default and then go back to the pretty permalinks.

I am using a nginx server built with easyengine. The wordpress pretty permalinks work effortlessly.

Step 3: Create a template page to show all the custom posts grouped under ‘articles’.

Create a new file in notepad called “page-articles.php” and paste the following code in it:



 * @package WordPress

 * @subpackage U-Design



 * Template Name: Articles


get_header(); ?>


    $args = array(

        'post_type' => 'articles',

        'posts_per_page' => 10,

        'orderby' => 'rand'


    $the_query = new WP_Query( $args );


<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

<header class="entry-header">

<h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>


<div class="entry-summary">

<?php the_excerpt(); ?>

<a href="<?php echo get_permalink(); ?>"> Read More...</a>



<?php endwhile; else : ?>

    <p>There are no articles :( </p>

<?php endif;

wp_reset_postdata(); ?>

<?php get_footer(); ?>

Upload the file to the folder which has the “page.php” template.

Now, go to Pages > Add New Page in the dashboard. Name the page whatever you want, such as “My Latest Articles” or anything else. In the “Template” section to the right, choose “Articles” from the drop down menu.

Publish the page and view it. You should be able to see the two articles titled “Article 1” and “Article 2” in it.

You can modify the look and feel of the page by tinkering with the template file called “page-articles.php” that we created earlier.

Step 4: Create a template file to show the single posts:

If you click each article, it will display in the default single page template.

To change this, download the “single.php” file. Open it in notepad and make the changes you want. Thereafter rename the file as “single-articles.php” and upload it to the same folder in which single.php resides.

Clear the cache (if you have WP Super Cache) and refresh the single post, you should be able to view the post in the new single post template.

The logic is that Wordpress will display all pages and posts in the default page.php and single.php templates respectively. However, if you create a new type of custom post and append the name of that post to a new page and single post template, Wordpress will display them in that template.

Now, you can create a menu item to append the articles. It will display separately from the other posts.

So, it is that simple to have  custom posts thanks to wordpress and the plugins.

The tutorials on pagination on wordpress custom posts are at and

XenForo Forum: How To Show Date Of Joining, Number Of Messages, Likes Received And Trophies Of Members

By // No comments:
If you would like to show the date of joining, number of messages, likes received and trophies of members in your Xenforo forum, go to the Admin control panel, click on the appearance tab, click on ‘style properties’ and then ‘message elements’. Select, ‘show custom user fileds’, ‘author registration date’, author message count’, ‘number of like’, ‘author trophy points’ etc, as desired.

This youtube video explains the procedure clearly:

VirtualMin: 413 “Request Entity Too Large” error with uploading a file

By // No comments:
In a normal nginx installation, this error is solved by making an amendment to the nginx.conf file and the php.ini file.

The nginx.conf file is found at /etc/nginx/nginx.conf while php.ini is to be found at /etc/php.ini

VirtualMin Wordpress Nginx Permalinks

By // No comments:

VirtualMin Wordpress Nginx Permalinks

If you want to use Virtualmin with nginx, there are two nice tutorials (Using Nginx with Virtualmin and Virtualmin with NGINX+PHP-FPM+OPCACHE).

To get the Wordpress permalinks to work, do the following:

Go to Virtualmin > Services > Configure Nginx Website > Return to virtual hosts list > Edit Configuration Files.

Nginx.conf rules for Wordfence Falcon Engine Caching when using Nginx and PHP5-FPM

By // No comments:
Wordfence is a free Wordpress plugin that provides security for your wordpress installation. It has a nice feature that scans your wordpress files and compares it with the original to see if they have been modified.

However, the scan is not foolproof. It does not cover all the core wordpress files or the themes or the plugins. Also, if the hacker has inserted new files, that goes undetected.

Wordpress Shows Login Page For Entire Site

By // No comments:
Today, I had an unpleasant experience. When I tried to access my site, I was presented with a peculiar login page. No page was accessible. Even the wp-admin.php page was blocked out by the login page. There was only one input box for the password (see image).

MicroAd Hijacks Browsers & Hides Google Adsense Ads

By // No comments:
I have several websites where I have Google Adsense Ads running.

Today, when I was browsing my websites, I was surprised to see some shady-looking ads showing. The ads appeared to be of companies called “Poster Gully”, “Styleever”, “fashion” etc.

If you peer closely at the ads, you will find an icon towards the right-hand side, similar to the ones found in the Adsense ads.
Powered by Blogger.