• I have a custom post type called “articles” where I want to be able to click on a menu link and display a number of article summaries (title, author, date, excerpt) on one page — in the same way an index.php page would display ordinary posts.

    Currently, I have an “Articles” blank page so these summaries are being displayed by using a template: archive-articles.php (as the Codex suggests) but this displays an “Archives” heading at the top. I need to find a way to get rid of the “Archives” heading when the intention is just displaying the “Articles” page, but still allow this heading when I’m clicking a link to actually show an archive.

    There has to be a way to do this… any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    A lot of it does deal with the theme, of course. What does the archive-articles.php look like? If more than 10 lines please use a gist or pastebin.com to post the code. 🙂

    Thread Starter FeralReason

    (@feralreason)

    archive-articles.php is a copy of Twentythirteen’s archive.php. The relevant code is:

    <h1 class="archive-title"><?php
     if ( is_day() ) :
       printf( __( 'Daily Archives: %s', 'twentythirteen' ), get_the_date() );
     elseif ( is_month() ) :
       printf( __( 'Monthly Archives: %s', 'twentythirteen' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentythirteen' ) ) );
     elseif ( is_year() ) :
       printf( __( 'Yearly Archives: %s', 'twentythirteen' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentythirteen' ) ) );
     else :
       _e( 'Archives', 'twentythirteen' );
     endif;
    ?></h1>

    You can see that the content of the H1 tag is changed according to tests of is_day(), is_month(), etc. However, I know of no “if condition” I can check to determine whether or not to display ‘Archives’ in the H1. Functions like is_archive() or is_post_type_archive(‘articles’) will always return TRUE. (I’ve tried these.)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to display an index-like page for "Custom Post Types"’ is closed to new replies.