• Twentyfourteen’s content.php states that it’s “used for both single and index/archive/search.” I don’t have great php skills so it’s been a problem for me, since anytime I make a change to one, the other one changes along with it.

    Does anyone know how to split the code (below) so that single post and posts in category/archive pages aren’t lumped together in terms of the entry-header and the entry-meta? I’d really appreciate it.

    <header class="entry-header">
    	<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
    		<div class="entry-meta">
    		<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
    		</div>
    
    		<?php
    			endif;
    
    			if ( is_single() ) :
    				the_title( '<h1 class="entry-title">', '</h1>' );
    			else :
    				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
    			endif;
    		?>
Viewing 1 replies (of 1 total)
  • Thread Starter 72brb

    (@72brb)

    It seems I solved at least part of it. This is my replacement code (in my child theme’s content.php):

    <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) ;
    	if ( is_single() ) : ?>
    		<div class="entry-meta">
    		<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
    		</div>
    	<?php the_title( '<h1 class="entry-title">', '</h1>' ); 
    
    			else :
    				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
    			endif;
    		?>

Viewing 1 replies (of 1 total)
  • The topic ‘content.php in twentyfourteen’ is closed to new replies.