WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

function create_post_type() {
    register_post_type( 'cpt_docs',
            '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.

share|improve this question
but this shows ALL the posts by date.I need to show dates only for my custom post type. – Oterox Jun 25 '11 at 10:51
remember its not in a template file, its on the homepage – Oterox Jun 25 '11 at 11:10
up vote 0 down vote accepted

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


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

Thk all.

share|improve this answer

Your Answer


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.