I search for an hour now without result. Does anyone can explain me how to show my custom post_type (dictionnaire) in the homepage (index.php). I use 'Easy post type' to add custom post types and I checked the "Query Var" checkbox. Please help...

The only posts that appears in my homepage are the regular one.

  • What exactly do you want to do? What are you using them for? You know it requires coding, right? It is "custom" for a reason :P – Miha Rekar Oct 12 '12 at 11:03

It would be something like this (goes in functions.php or elsewhere, but not template):

add_action( 'pre_get_posts', 'include_dictionnaire_in_home' );

function include_dictionnaire_in_home( $query ) {

    if ( ! is_admin() && $query->is_main_query() && $query->is_home() ) {
        $query->set( 'post_type', array( 'post', 'dictionnaire' ) );

Note that index.php template is not strictly home template. It is catch-all template that is used if no better hierarchy match is available. It's just common for home because more specific template is rarely provided for it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.