Conditional tag only for front of custom post type
Question
I’ve created the custom post type (CPT) called ‘projects’:
$post_type_args = array(
//...
'has_archive' => true,
'rewrite' => array(
// 'slug' => '', // Defaults to $post_type key
// 'with_front' => true, // Default true
// 'feeds' => 'true', // Default has_archive value
// 'pages' => true, // Default true
// 'ep_mask' => EP_PERMALINK,
),
);
register_post_type( 'projects', $post_type_args );
And I would like the use a conditional tag only for the front page of the CPT.
In my case is the page with the slug /projects
.
I can use $_SERVER
array like this:
if ( $_SERVER['REQUEST_URI'] == "/projects/" ) { //... }
But is there something like is_shop()
conditional tag in WooCommerce for this case?
Thank you in advance.
0
2 years
2020-12-09T06:10:23-05:00
2020-12-09T06:10:23-05:00 0 Answers
5 views
0
Leave an answer