• Resolved mdemora

    (@mdemora)


    Hi, I am using the last versión (4.2.4) and the Twenty Fifteen theme.

    I would like to display only the post titles when I am on a category page and on a search results page. I want to hide the rest of information – author, date, excerpt…

    what code should I remove or add?

    Thank you in advance! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • the following will only work if you are not using any post_formats:

    make a copy of archive.php and save it as category.php in your child theme;

    then edit this category.php, and replace this line:

    get_template_part( 'content', get_post_format() );

    with:

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    	<header class="entry-header">
    		<?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
    	</header><!-- .entry-header -->
    
    </article><!-- #post-## -->

    or reduce the code even further …

    Thread Starter mdemora

    (@mdemora)

    Thanks! It works!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to display only the post titles in a category page’ is closed to new replies.