Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1120673
    Razorsharp_
    Participant

    Hi,

    I’ve read through a few threads but haven’t been able to get anything to work. I’d love to be able to add some content or even show a description above my category page in Renew.

    Any ideas?

    #1120674
    Razorsharp_
    Participant
    This reply has been marked as private.
    #1120852
    Christian
    Moderator

    Hey there,

    This requires template overriding so using a child theme is strongly recommended.

    Backup your site before and see https://community.theme.co/kb/how-to-setup-child-themes/ to learn how to setup a child theme.

    After that, you will need to copy _index.php located in wp-content\themes\x\framework\views\global to the same folder structure in your child theme wp-content\themes\x-child\framework\views\global. Open the copied file and place the code below:

    <?php if (is_archive()) : ?>
      <h3>Your Content</h3>
    <?php endif; ?>

    above the line:

    <?php if ( $condition ) : ?>

    Please take note that the code given serves only as a guide. Any issues arising from the use of it and or further detailed customization would fall outside the scope of our support. In which case, you might want to contact our trusted partners who caters X setup and customization needs. Please see https://community.theme.co/custom-development/

    Thanks.

    #1159997
    armintz
    Participant

    I’m looking to do the same exact thing, but the only solutions that I’ve found on the forums involve global content across your entire blog. It would be better UX to have it category specific, so you could create unique content specific to whichever category your user is viewing.

    #1160311
    Rue Nel
    Moderator

    Hello There,

    Thanks for updating this thread! You can insert a custom content in the category description instead. You can go to Posts > Categories > Edit category and insert the description. By default, it will not accept html codes. To be able to allow the html codes, you must add this line in your child theme’s functions.php file

    // Displays category descriptions
    // =============================================================================
    remove_filter( 'pre_term_description', 'wp_filter_kses' );
    remove_filter( 'term_description', 'wp_kses_data' );
    
    function display_category_descriptions(){
      if ( is_category() ) : ?>
        
        <div class="category-desc">
          <div class="x-container max width">
            <div class="category-desc-contents">
              <?php echo category_description(); ?> 
            </div>
          </div>
        </div>
    
      <?php elseif( is_single() ) : ?>
    
        <?php 
          $f_category = get_the_category();
    
          if ( $f_category[0]->category_parent != 0 ) {
             $f_category_name = get_cat_name( $f_category_id );
          } else {
             $f_category_name = $f_category[0]->name;
          }
        ?>
        
        <div class="category-desc">
          <div class="x-container max width">
            <div class="category-desc-contents">
              <?php echo category_description( get_category_by_slug($f_category_name)->term_id ); ?> 
            </div>
          </div>
        </div>
    
      <?php else : ?>
    
      <?php endif;
    }
    add_action('x_after_view_{your-stack}__landmark-header', 'display_category_descriptions');
    // =============================================================================

    This will display the category descriptions below the landmark.

    Hope this helps.

  • <script> jQuery(function($){ $("#no-reply-1120673 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>