Skip to main content

Posts

Showing posts with the label post

How to Create Custom Post Types in WordPress without using Plugin

WordPress has many different content types. A single item of content is called a post, also post is a specific post type. All the post types are stored in the same database table (wp_posts) and differentiated by a column called post_type. By default, five post types are available in WordPress. Post (Post Type: ‘post’) Page (Post Type: ‘page’) Attachment (Post Type: ‘attachment’) Revision (Post Type: ‘revision’) Navigation menu (Post Type: ‘nav_menu_item’) Also, you can create new post types which are called Custom Post Types. A custom post type can be added to WordPress using register_post_type() function. It very simple and you don’t need to use any plugin for that, you can register your custom post types without using Plugin. In this article, we’ll show you how to create custom post types in WordPress. Also, you’ll know how to add taxonomy or category of custom post types in WordPress. WordPress custom post type helps you to divide up your website content in a more stru...

WordPress – How to Display Most Popular Posts by Views

Displays the most viewed posts at the sidebar are very helpful for visitors to find out the most popular post of your site. This tutorial will show you the simple way to display the most popular posts by views without using any plugin. You can get the most popular posts using simple WordPress most viewed posts query. We’ll use the post Meta for storing the post views count. Using the stored Meta value, we’ll fetch the posts according to the views count. You need to modify only two files functions.php and single.php . After that, you can display the most popular posts using simple posts query. functions.php File Open the functions.php file of the activated theme and add the following code. setPostViews() function add or update the post meta with post_views_count meta key. /*  * Set post views count using post meta  */ function setPostViews($postID) {     $countKey = 'post_views_count';  ...