Test An Entry Is A Custom Post Type Easily

 What really are Custom Post Types?

Suppose you wish your web log to possess a separate section for flick Reviews. By mistreatment Custom Post type you’ll produce a replacement style of item like Posts and Pages, which is able to contain a distinct set of information. it’ll have a replacement administration menu, dedicated piece of writing pages, custom taxonomies and lots of a lot of utilities needed for full fledged business.

test an entry is a custom post type easily

Custom Post sorts ar a replacement set of body choices showing in conjunction with the default post sorts like Posts, Pages, Attachments etc. A Custom Post sort will store any style of data. it’s a frenzied editor, media uploader and uses the prevailing WordPress table structure for ease in knowledge management. the most advantage of making custom post sorts mistreatment the WordPress API is that it equips itself well with existing themes and templates. Custom Post sorts are SEO friendly as a result of their peachy permalinks.

 Why Use Custom Post Types?

Custom Post type facilitate us to stay differing types of posts in several buckets. It separates our regular posts from others. straightforward enough!

How to test custom post type easily

As you have been work with wordpress you may know about custom post type. Do you want to test if an entry is a specific post type easily? Read the custom post type article for know more about custom post type. If you want to do this ,here is a simple and short tips for you to do. Look at the following function.

 custom post type easily

custom post type

Simply copy and paste the following function into your functions.php file of your wordpress root folder:

function wpr_is_post_type($type){
 global $wp_query;
 if($type == get_post_type($wp_query->post->ID)) return true;
 return false; 
}

After doing this you can use this in your theme.

if (wpr_is_post_type($type){
    ...
}

If you like this article, please share it with your friends.

Roy Jemee is a professional Blogger. Apart of blogging he likes to play with mathematics. He knows Blogging, Wordpress, PHP, javascript , SEO and some other.