• Resolved Hakkelaar

    (@hakkelaar)


    Dear folks,

    In older themes like twentyfourteen I see category.php and tag.php.

    However, in newer themes I only see archive.php.

    If I change (or put in some php in) this file, both the category-pages of my site and the tag-pages change.

    Question: How do I make changes for tag-pages only?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator James Huff

    (@macmanx)

    Lots of modern themes take the approach where archive.php covers all archive-type pages. Loosely described, part of the files says “If it’s a tag page, do these tag things,” etc.

    How you modify it though depends on the specific theme, as many are constructed differently.

    What is the name of the theme in question?

    Thread Starter Hakkelaar

    (@hakkelaar)

    Dear James,

    Thanks for your quick response!

    The name of the theme is Lovecraft, but I also see this in TwentySixteen.

    I really can’t tell where the code is that deals with tags, and the code that deals with categories in this archive.php:

    <?php get_header(); ?>
    
    <div class="wrapper section">
    
    	<div class="section-inner">
    
    		<div class="content">
    
    			<div class="page-title">
    
    				<div class="section-inner">
    
    					<h4><?php if ( is_day() ) : ?>
    						<?php printf( __( 'Date: %s', 'lovecraft' ), '' . get_the_date( get_option('date_format') ) . '' ); ?>
    					<?php elseif ( is_month() ) : ?>
    						<?php printf( __( 'Month: %s', 'lovecraft' ), '' . get_the_date('F Y') . '' ); ?>
    					<?php elseif ( is_year() ) : ?>
    						<?php printf( __( 'Year: %s', 'lovecraft' ), '' . get_the_date( 'Y' ) . '' ); ?>
    					<?php elseif ( is_category() ) : ?>
    						<?php printf( __( 'Category: %s', 'lovecraft' ), '' . single_cat_title( '', false ) . '' ); ?>
    					<?php elseif ( is_tag() ) : ?>
    						<?php printf( __( 'Tag: %s', 'lovecraft' ), '' . single_tag_title( '', false ) . '' ); ?>
    					<?php elseif ( is_author() ) : ?>
    						<?php $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?>
    						<?php printf( __( 'Author: %s', 'lovecraft' ), $curauth->display_name ); ?>
    					<?php else : ?>
    						<?php _e( 'Archive', 'lovecraft' ); ?>
    					<?php endif; ?>
    
    					<?php
    					$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    					if ( "1" < $wp_query->max_num_pages ) : ?>
    
    						<span><?php printf( __('(Page %s of %s)', 'lovecraft'), $paged, $wp_query->max_num_pages ); ?></span>
    
    						<div class="clear"></div>
    
    					<?php endif; ?></h4>
    
    				</div> <!-- /section-inner -->
    
    			</div> <!-- /page-title -->
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php rewind_posts(); ?>
    
    				<div class="posts" id="posts">
    
    					<?php while ( have_posts() ) : the_post(); ?>
    
    						<?php get_template_part( 'content', get_post_format() ); ?>
    
    					<?php endwhile; ?>
    
    				</div> <!-- /posts -->
    
    				<?php lovecraft_archive_navigation(); ?>
    
    			<?php endif; ?>
    
    		</div> <!-- /content -->
    
    		<?php get_sidebar(); ?>
    
    		<div class="clear"></div>
    
    	</div> <!-- /section-inner -->
    
    </div> <!-- /wrapper.section -->
    
    <?php get_footer(); ?>
    Moderator James Huff

    (@macmanx)

    I don’t see any clear content-based distinctions in that file, so either the content is described separately elsewhere, or the theme provides one style for everything.

    I recommend asking at https://www.ads-software.com/support/theme/lovecraft#postform so the theme’s developers and support community can help you with this.

    Thread Starter Hakkelaar

    (@hakkelaar)

    This is the archive.php from TwentySixteen.

    Can you point out the distinction-code between tag-pages and category-pages in this file?

    get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<main id="main" class="site-main" role="main">
    
    		<?php if ( have_posts() ) : ?>
    
    			<header class="page-header">
    				<?php
    					the_archive_title( '<h1 class="page-title">', '</h1>' );
    					the_archive_description( '<div class="taxonomy-description">', '</div>' );
    				?>
    			</header><!-- .page-header -->
    
    			<?php
    			// Start the Loop.
    			while ( have_posts() ) : the_post();
    
    				/*
    				 * Include the Post-Format-specific template for the content.
    				 * If you want to override this in a child theme, then include a file
    				 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    				 */
    				get_template_part( 'template-parts/content', get_post_format() );
    
    			// End the loop.
    			endwhile;
    
    			// Previous/next page navigation.
    			the_posts_pagination( array(
    				'prev_text'          => __( 'Previous page', 'twentysixteen' ),
    				'next_text'          => __( 'Next page', 'twentysixteen' ),
    				'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>',
    			) );
    
    		// If no content, include the "No posts found" template.
    		else :
    			get_template_part( 'template-parts/content', 'none' );
    
    		endif;
    		?>
    
    		</main><!-- .site-main -->
    	</div><!-- .content-area -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    Moderator James Huff

    (@macmanx)

    Twenty Sixteen does not make any distinction between the appearance of category and tag pages, which is why I suggested asking at https://www.ads-software.com/support/theme/lovecraft#postform so your specific theme’s developers and support community can help you with modifying your specific theme.

    Thread Starter Hakkelaar

    (@hakkelaar)

    I understand in what way you are trying to help me.

    I asked about the TwentySixteen code because I want to learn more about WordPress and thought that I could better start with WordPress’ it’s own themes for learning.

    Moderator James Huff

    (@macmanx)

    Ah, ok. Fully customizing out the Twenty Sixteen theme in that way is not something I have the time to offer for free right now, sorry.

    Someone at https://www.ads-software.com/support/theme/lovecraft#postform or https://www.ads-software.com/support/theme/twentysixteen#postform may be more prepared to help you with that, depending on which theme you want to use.

    Thread Starter Hakkelaar

    (@hakkelaar)

    Ok, Thanks!

    I will mark this thread as resolved in the sense that my question is theme-dependent.

    Moderator James Huff

    (@macmanx)

    You’re welcome!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Make changes to tag-pages only (what happend to category.php and tag.php?)’ is closed to new replies.