Proper after_setup_theme and wp_head cleanup

What you should do: Read Where to put my code: plugin or functions.php? and apply the lessons to your theme. Themes are for presentation only. Remove everything not related to presentation: do not touch link and meta elements in the header. That’s plugin territory. Remove redundant code. add_theme_support(‘menus’); is not necessary, if you call register_nav_menus(). … Read more

Filter Posts from the Main Query

Untested: function custom_home_exclude( $where=”” ) { $exclude = array(); $newsQuery = new WP_Query (array( “post_type” => “news”, “meta_key” => “post_to_blog”, “meta_value” => 1, “meta_compare” => “!=”, “posts_per_page” => “-1″, )); while ($newsQuery->have_posts()) { $newsQuery->the_post(); array_push($exclude, get_the_ID()); } wp_reset_query(); $exclude = join(‘,’, $exclude); $where .= ” AND `ID` NOT IN ($exclude)”; return $where; } function custom_home_loop($query) … Read more