Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #123139

    integris
    Participant

    Hello –

    Can someone tell me how I can have my Renew child theme display the category’s name and description on the category page instead of the text “Category Archive”?

    I’ve set up a child theme, and I imagine this is a fairly simple edit to the function.php page… I just have no idea what it would be 🙂

    Thanks in advance!
    -joe

    #123421

    Christopher
    Moderator

    Hi there,

    Please put this code inside function.php

    <?php if ( is_category() ) : ?>
    
    <?php
    
      $meta     = x_get_taxonomy_meta();
      $title    = ( $meta['archive-title']    != '' ) ? $meta['archive-title']    : __( 'Category Archive', '__x__' );
      $subtitle = ( $meta['archive-subtitle'] != '' ) ? $meta['archive-subtitle'] : __( "", '__x__' ) . '<strong>&ldquo;' . single_cat_title( '', false ) . '&rdquo;</strong>';
    
      ?>
    <?php endif; ?>

    Hope it helps.

    #123556

    integris
    Participant

    Thanks for the code, but it didn’t do anything.
    Any other suggestions?

    Much appreciated,
    -joe

    #123874

    Rad
    Moderator

    Hi there,

    Have you tried editing your categories and changed their title and sub title?

    Admin > Posts > Categories then choose a category then add your title and sub title.

    Thanks.

    #124979

    integris
    Participant

    > Have you tried editing your categories and changed their title and sub title?

    Yes.

    The “Archive Title” displays on the category page, regardless of whether or not I use your code. But I cannot get the description to display.

    Any other suggestions?

    Thank you,
    joe

    #125207

    Cousett
    Member

    Try adding this instead

    <?php if (is_category()) { ?>
    <h2 class="pagetitle">Archive for the '<?php echo single_cat_title(); ?>' Category</h2> <br /> <?php echo category_description(); ?>
    <?php endif; ?>
    #125383

    integris
    Participant

    Thanks for the code, but no luck.

    I tried simply testing “is_category” and also couldn’t get it to work:

    <?php if ( is_category() ) { ?>
    
    <p>This is a category</p>
    
    <?php } ?>

    Any other suggestions?

    Thank you,
    -joe

    #125646

    Kosher K
    Member

    Hi Joe,

    Sorry for the confusion,

    To change the category title, you need to copy and edit this file to your child theme x/framework/views/renew/_landmark-header.php.

    Then you’ll see something like this, from line 57 to 66

    <?php elseif ( is_category() || x_is_portfolio_category() || x_is_product_category() ) : ?>
    
                <?php
    
                $meta  = x_get_taxonomy_meta();
                $title = ( $meta['archive-title'] != '' ) ? $meta['archive-title'] : __( 'Category Archive', '__x__' );
    
                ?>
    
                <h1 class="h-landmark"><span><?php echo $title; ?></span></h1>

    You can then change it to something like this

    <?php elseif ( is_category() || x_is_portfolio_category() || x_is_product_category() ) : ?>
    <h1 class="h-landmark"><?php single_cat_title(); ?> </span></h1>
    <p class="cat-desc"><?php echo category_description(); ?></p>

    Hope that clarifies,

    Have a great day

    #125813

    integris
    Participant

    Perfect – just what I needed – thanks so much!
    -joe

    #126005

    Darshana
    Moderator

    Glad we were able to help 🙂

    #619238

    sndesign
    Participant

    This was helpful – Thank you!

    #619250

    Christopher
    Moderator

    You’re welcome.

    #770640

    Molmedia
    Participant

    Thanks for the help!

    I have 2 questions:

    1 | Is it possible to show the post thumpnails/excerpts above the category content instead of below?
    2 | Is it possible to use cornerstone or shortcodes in the category content? Now i can only place content in the category with the standard wordpress editor..

    Thanks in advance!

    Hans

    #771286

    Rad
    Moderator

    Hi Molmedia,

    1. Sure possible, but instead of adding <p class="cat-desc"><?php echo category_description(); ?></p> to x/framework/views/renew/_landmark-header.php, it should be added at /x/framework/views/global/_index.php

    Like this,

    <?php pagenavi(); ?>
    <?php if ( is_category() ) :?>
    <p class="cat-desc"><?php echo category_description(); ?></p>
    <?php endif; ?>

    2. You can’t use cornerstone, but yes, shortcode could be possible and you may change your code to
    this.

    <?php pagenavi(); ?>
    <?php if ( is_category() ) :?>
    <p class="cat-desc"><?php echo do_shortcode( category_description() ); ?></p>
    <?php endif; ?>

    Thanks!

    #777716

    Molmedia
    Participant

    Thanks for the quick response, It all worked great!