WordPress custom post type data…
-
How to get post type data in the archive page?
I want post_type slug add class name body. For fallback on the css!
post_type_archive_title('',false)
It return current archive post type (Title)!function post_type_slug(){ $post_type = get_post_type(); if ( $post_type ) { $post_type_data = get_post_type_object( $post_type ); $post_type_slug = $post_type_data->rewrite['slug']; return $post_type_slug; } else return false; }It work just current post type archive page have while post!
If archive is empty return ” ”
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘WordPress custom post type data…’ is closed to new replies.