Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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