Support » Theme: Founder » Show category description

  • Hi again,

    i want to show the category title and description before the posts on subpages. is this possible?

    thaks.

    • This topic was modified 1 month, 3 weeks ago by fantasyname.
    • This topic was modified 1 month, 3 weeks ago by fantasyname.
Viewing 15 replies - 1 through 15 (of 19 total)
  • Theme Author Ben Sibley

    (@bensibley)

    That can be done with your child theme too. Are you comfortable making a few PHP edits?

    You can copy Founder’s index.php file into your child theme. Line three gets the category and description like this:

    get_template_part( 'content/archive-header' ); ?>

    Copy & paste that after the opening PHP tag (<?php) on Line 16. Then the posts will show up before the category title and description.

    Thread Starter fantasyname

    (@dam95)

    Hm, I did that but then it shows only

    “ct_founder_pagination(); get_footer();” under the postings.

    <?php get_header();
    
    get_template_part( 'content/archive-header' ); ?>
    
    <div id="loop-container" class="loop-container">
    	<?php
    	if ( have_posts() ) :
    		while ( have_posts() ) :
    			the_post();
    			ct_founder_get_content_template();
    		endwhile;
    	endif;
    	?>
    </div>
    
    <?php get_template_part( 'content/archive-header' ); ?>
    ct_founder_pagination();
    
    get_footer();
    Theme Author Ben Sibley

    (@bensibley)

    Sorry for the delay.

    Here is how the complete code snippet should look. The closing php tag ?> is removed so the pagination will now work properly:

    <?php get_header();
    
    get_template_part( 'content/archive-header' ); ?>
    
    <div id="loop-container" class="loop-container">
    	<?php
    	if ( have_posts() ) :
    		while ( have_posts() ) :
    			the_post();
    			ct_founder_get_content_template();
    		endwhile;
    	endif;
    	?>
    </div>
    
    <?php 
    get_template_part( 'content/archive-header' );
    ct_founder_pagination();
    
    get_footer();
    Thread Starter fantasyname

    (@dam95)

    Thx. I tried that but nothing changed on the category-page.

    Theme Author Ben Sibley

    (@bensibley)

    I’m sorry I think I’ve been reading this wrong. The category title and description should both show up above your posts without any changes required. For example, you can see them on this category page on the Founder demo site: https://founder.competethemes.com/category/fashion/

    Is this not the case for your website? If so, could you link me to one of your category pages so I can check it out?

    Thread Starter fantasyname

    (@dam95)

    That is unfortunately not the case.
    The site isn’t online yet.

    Could the html code of one category page help?

    Theme Author Ben Sibley

    (@bensibley)

    There must be some CSS on the site hiding this text then. Is there any custom CSS added to the site in the Customizer or by a plugin?

    If you visit a category page, right-click and select the “View source” option, you can view the live HTML. Search the page for “archive-header” and let me know if you see it. It should look something like this: https://share.getcloudapp.com/8LuowQo7

    If the HTML is present then that means the element is being hidden with CSS. If not, it means there might be something in the child theme affecting the output.

    Thread Starter fantasyname

    (@dam95)

    Unfortunately I don’t see “archive-header” in the html-code. :/

    Can I do something about this issue with the child theme?

    Theme Author Ben Sibley

    (@bensibley)

    Try re-adding this code to the content/archive-header.php file. There must have been an extra edit made there on the site:

    <?php
    
    // Don't output on bbPress (Forum pages count as archives)
    if ( function_exists( 'is_bbpress' ) ) {
    	if ( is_bbpress() ) {
    		return;
    	} 
    }
    if ( is_home() ) {
    	echo '<h1 class="screen-reader-text">' . esc_html( get_bloginfo("name") ) . ' ' . esc_html__('Posts', 'founder') . '</h1>';
    }
    if ( ! is_archive() ) {
    	return;
    }
    
    $icon_class = 'folder-open';
    
    if ( is_tag() ) {
    	$icon_class = 'tag';
    } elseif ( is_author() ) {
    	$icon_class = 'user';
    } elseif ( is_date() ) {
    	$icon_class = 'calendar';
    }
    
    if ( is_author() ) { ?>
    	<div class='archive-header'>
    		<?php echo get_avatar( get_the_author_meta('ID'), 36); ?>
    		<h1>
    			<?php the_archive_title(); ?>
    		</h1>
    		<?php the_archive_description(); ?>
    	</div>
    <?php } else { ?>
    	<div class='archive-header'>
    		<i class="fas fa-<?php echo esc_attr( $icon_class ); ?>"></i>
    		<h1>
    			<?php the_archive_title(); ?>
    		</h1>
    		<?php the_archive_description(); ?>
    	</div>
    <?php }

    You can also delete the index.php file from your child theme.

    In a previous thread, I provided the code above in a child theme to add the author’s avatar, and if this code is in place, it will definitely also output the category title and description on category archive pages.

    Thread Starter fantasyname

    (@dam95)

    Now i see the description, but why is it above and under the posts then? It should be only before the posts.
    (And the icon with the category-name isnt necessary, too)

    • This reply was modified 1 month, 2 weeks ago by fantasyname.
    Theme Author Ben Sibley

    (@bensibley)

    This is due to an edit we were making in the index.php file. You can just delete the index.php file from the child theme and the description will only show above.

    If you don’t want the icon to display, please delete this line from archive-header.php:

    <i class="fas fa-<?php echo esc_attr( $icon_class ); ?>"></i>

    Thread Starter fantasyname

    (@dam95)

    Thanks, that works.

    Theme Author Ben Sibley

    (@bensibley)

    Great, glad that resolved the issue.

    Thread Starter fantasyname

    (@dam95)

    Hello,
    before the category name it says “Category”, f.e. “Category: New”. Is there a way that i can delete the text “Category” before the actual category-name? And how can i change the way it looks, f.e. i want the font-size 20px (the same way the site-headlines are).

    Theme Author Ben Sibley

    (@bensibley)

    This CSS will work well to hide that text and resize the category name:

    .archive-header h1 {
      font-size: 0;
    }
    .archive-header h1 span {
      font-size: 20px;
    }
Viewing 15 replies - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.