Addind Custom Post Type Support to home.php

How can I add support for a custom post type to my home (blog) page in bp-daily?

I’d like it to query ‘posts’ and ‘news-links’

I tried adding this to functions.php but it didn’t work:

/*show news links on home page */

function my_get_posts( $query ) {

if ( ( is_latest_posts() && false == $query->query_vars ) || is_feed() )

$query->set( 'post_type', array( 'post', 'page', 'news-links') );

return $query;

}

I ain’t a coder – would adding something like this to home.php do the trick?

<?php query_posts('array( 'posts', 'news-links' )); ?>

Thanks!

  • Ulrich
    • The Crimson Coder

    Use this:

    /*show news links on home page */

    function my_get_posts( $query ) {

    if ( ( is_home() && false == $query->query_vars ) || is_feed() )

    $query->set( 'post_type', array( 'post', 'page', 'news-links') );

    return $query;

    }

    add_filter( 'pre_get_posts', 'my_get_posts' );

  • gregfielding
    • The Incredible Code Injector

    Thanks UIrich…that code gave me WSOD. It’s probably a conflict with something else I have going on.

    I did find a solution.

    I added this code to content-rows.php

    <?php query_posts( array( 'post_type' => array( 'post', 'news-links' ) ) ); ?>

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.