Is there a function that simply returns the current "page type" instead of using is_page(), is_preview(), is_single(), is_archive(), etc?
For example: I can find the current "post type" but I can't find it's corresponding "page type".
|
Is there a function that simply returns the current "page type" instead of using is_page(), is_preview(), is_single(), is_archive(), etc? For example: I can find the current "post type" but I can't find it's corresponding "page type". |
|||
|
|
|
You need your own helper function which will return you what you need. It could be like this one:
|
|||
|
but even than that page can be a single or archive or anything else... What you tring to achive? Perhaps in that case will be more understand what you need. update. take a look to sample theme function that you can use to achive this task. function called twentyeleven_body_classes from Twentyeleven theme. it returns clases that can be used for body_classes filter
nothing holding you from not adding to it additional classes. is_archive() or something else... in this case you got a page types you want. |
|||||
|
|
If you place this template tag within the Body tag Alternatively you could echo the path to the page template being called i.e. page.php or single-posttype.php by using this: |
||||
|
|