0

I have a custom post type called "cpt_docs": add_action( 'init', 'create_post_type' );

function create_post_type() {
    register_post_type( 'cpt_docs',
        array(
            'labels' => array(
                'name' => __( 'Docs' ),
                'singular_name' => __( 'Doc' )
            ),
        'public' => true,
        'has_archive' => true,
        )
    );
}

I have tabs with months and i want to show the "docs" for that month. I need to show the custom post types in the home page, bu i dont how can i do that.

Should i use a hard coded sql query or there is another way?

thk all.

0

Well, it works if i use a filter like this:

add_filter('getarchives_where','docs_filter');

function docs_filter($where_clause) {
  return "WHERE post_type = 'cpt_docs' AND post_status = 'publish'";
}

Thk all.

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.