Support for custom post types and custom taxonomies

  • Anonymous


    I have been working in a school magazine made with Graphene, which is based on a custom post type called “articulo” and two custom taxonomies, called “seccion” and “numero”.

    I have been able to display the custom post type in the slider with this function, defined in my child theme

    function graphene_custom_slider_post_type( $post_types ){
    $post_types[] = 'articulo';
    return $post_types;
    add_filter( 'graphene_slider_post_type', 'graphene_custom_slider_post_type' );

    However, I haven’t been able to display the custom post type articles in the front page panels. I’ve tried with a custom query and pre_get_posts, as Bill Erickson explains (; it works fine in home page, but it doesn’t work properly in front page panels.

    This is my code, in

    add_filter( 'pre_get_posts', 'my_get_posts' );

    function my_get_posts( $query ) {

    if ( ( is_home() && $query->is_main_query() ) || is_front_page() || is_feed() )
    $query->set( 'post_type', array( 'articulo', 'page', 'post', 'nav_menu_item' ) );
    return $query;

    It seems fine, but as the nav_menu_item is included in the query, the ouput of the RSS feed includes this post type, instead of ‘articulo’. If I remove nav_menu_item, then all menus disappear.

    Is there any way to include the ‘articulo’ custom post type in the query and get the desired results (or a filter to get this)?

    Thanks in advance,

    Eduardo Larequi.

Viewing 1 post (of 1 total)

  • You must be logged in to reply to this topic.