Still Delving into WordPress

Contact Us

  • Your Name (required)

    Your Email (required)

    Subject

    Your Message

Search

What we are saying

Still Delving into WordPress

Posted in: Websites, WordPress by koolkat on December 18, 2009

In order to augment my use of menus in #WordPress, I have been using the Page Lists Plus plugin. One of its features is to allow the anchor tag to be removed from the current page. This works fine except when the current page is the posts page. Since the plugin looks for the post ID ($post->ID), what gets returned is the id of the first post on the page and not the actual posts page! The solution to check and see if your current post is a page or a post. If its a post, then get the page ID for the posts:

if ($post->post_type == 'post') {
$currID = get_option('page_for_posts');
}
else {
$currID = $post->ID;
}

I know it seems simple but it took me awhile to figure it out.

You must be logged in to post a comment.