if category slug = page slug – do something useful
-
Hey up,
I’d like to do something with wordpress that I imagine is possible as this system is so adaptable.I use both the blog and static pages. In the blog I need to be able to display links to sub pages whose parent page has the same SLUG as the present blog category SLUG.
So If I have a blog category with slug “life-2006” and create a static parent page that has the slug “life-2006”, then all its sub page links would appear when viewing that coresponding blog category.
So I’d need to query the parent category slug and then look in the pages for a matching slug and if this is found – output links to the sub-pages.
sligowaths wrote this function:
function get_the_slug() {
global $post;
if ( is_single() || is_page() ) {
return $post->post_name;
}
else {
return “”;
}}
Not sure if any of it can be used.
Help :0
- The topic ‘if category slug = page slug – do something useful’ is closed to new replies.