/ Published in: PHP

Suppose you wanted to check if a user was viewing a singular post with the post type of testimonial. You can use the next code sample to perform this check.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php if ( is_singular( 'testimonial' ) ) { /* Run some code if viewing a singular testimonial. */ } ?>
URL: http://justintadlock.com/archives/2011/07/20/conditional-checks-for-custom-post-types
Comments
