WP Pull correct Post ID for Archive / Categories

<?php if(is_home() || is_archive() || is_category()) $post_id = get_option('page_for_posts'); else $post_id = $post -> ID; ?>
don't forget about archive and category
or those pages'll break
you'll also have to either include (and fix) or exclude altogether - search and 404

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.