• Hi.

    I’ve created the taxonomy ‘Departamentos’ which is common to regular posts and two custom post types. But when I try to display all posts within a taxonomy, I only get the regular posts.

    e.g.
    This post (a custom post type) and this post (a regular post) both are marked with the same taxonomy (“departamento de geofisica”). But the taxonomy archive — http://www.iag.usp.br/imprensa/?departamentos=departamento-de-geofisica — only displays the regular post.

    Also, the search tool only lists regular posts on the results, ignoring the custom post types content.

    Does anyone know how to get my custom post types included?

    (The crazy thing is: it worked fine on my test install — which uses the same version and the same functions and the same custom post types and the same custom taxonomies.
    http://lhys.org/iag/?departamentos=departamento-de-geofisica)

Viewing 6 replies - 1 through 6 (of 6 total)
  • I think:
    Your loop has to be told to show both ‘regular posts’ and ‘your custom post type posts’.
    Try the vid in the page for more info.
    http://www.wpbeginner.com/wp-tutorials/how-to-use-custom-post-types/
    Use query_posts for this.

    a tip: use the category.php template file

    Thread Starter lhys

    (@lhys)

    Hi, Peter

    Thanks for replying.
    I’ve tried to use the query_posts — it displayed all (regular) posts, but none of the custom post content.

    What bugs me the most about it is that I’ve uploaded the theme files from the test install (which included the loop.php and the category.php) and I’m running the same WP version with the same active plugins — but the same recipe doesn’t seem to work on the different install.

    what’s your query look like?

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts(array(
    	'post_type' => 've_products', // custom post type
             'paged'=>$paged,
            ));
    ?>

    is mine for displaying JUST my custom post type, I’m sure you can also include the ‘post’ post type to get both combining this in there:
    query_posts( array( 'post_type' => array('post', 'movie') ) );

    hmmm, hard to asses
    if it worked on a test version and not anymore now it might be something small you overlooked, a step you missed or something

    try querying only the custom posts to see if that works (all parameters correct) and then adding the default posts

    I tried this out myself and this did the trick for me

    global $query_string;
    query_posts($query_string . "&post_type=any");
    //the loop
    //Reset Query
    wp_reset_query();
    Thread Starter lhys

    (@lhys)

    if it worked on a test version and not anymore now it might be something small you overlooked, a step you missed or something

    I went into details these past days until I found one different setting on the WPML. (Yeah, now I feel lame.)

    Thank you for the help!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Custom post types not showing up on taxonomy archives and search results’ is closed to new replies.