Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1395700
    kenas
    Participant

    Hi, how to show category description on all categories ?

    https://goo.gl/e9WfFc

    #1395794
    kenas
    Participant

    also need to add shortcodes as well

    #1395810
    Christopher
    Moderator

    Hi there,

    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    Copy _index.php from framework/views/global and put it in the same path inside child theme, replace existing code with following :

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_INDEX.PHP
    // -----------------------------------------------------------------------------
    // Includes the index output.
    // =============================================================================
    
    $stack = x_get_stack();
    
    if ( is_home() ) :
      $style     = x_get_option( 'x_blog_style' );
      $cols      = x_get_option( 'x_blog_masonry_columns' );
      $condition = is_home() && $style == 'masonry';
    elseif ( is_archive() ) :
      $style     = x_get_option( 'x_archive_style' );
      $cols      = x_get_option( 'x_archive_masonry_columns' );
      $condition = is_archive() && $style == 'masonry';
    elseif ( is_search() ) :
      $condition = false;
    endif;
    
    ?>
    
    <?php if ( $condition ) : ?>
      <div class="category_description">
    <?php echo category_description(); ?>
    </div>
    
      <?php x_get_view( 'global', '_script', 'isotope-index' ); ?>
    
      <div id="x-iso-container" class="x-iso-container x-iso-container-posts cols-<?php echo $cols; ?>">
        <?php if ( have_posts() ) : ?>
          <?php while ( have_posts() ) : the_post(); ?>
            <?php if ( $stack != 'ethos' ) : ?>
              <?php x_get_view( $stack, 'content', get_post_format() ); ?>
            <?php else : ?>
              <?php x_ethos_entry_cover( 'main-content' ); ?>
            <?php endif; ?>
          <?php endwhile; ?>
        <?php else : ?>
          <?php x_get_view( 'global', '_content-none' ); ?>
        <?php endif; ?>
    
      </div>
    
    <?php else : ?>
    
      <?php if ( have_posts() ) : ?>
        <?php while ( have_posts() ) : the_post(); ?>
          <?php x_get_view( $stack, 'content', get_post_format() ); ?>
        <?php endwhile; ?>
      <?php else : ?>
        <?php x_get_view( 'global', '_content-none' ); ?>
      <?php endif; ?>
    
    <?php endif; ?>
    
    <?php pagenavi(); ?>

    also need to add shortcodes as well

    Regretfully this isn’t a feature offered by X. It could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

    Hope it helps.

    #1395833
    kenas
    Participant

    I set up a child theme.. but your provided code, did not work for me.
    I think it´s for ethos while i am using icon

    In the other hand, i tried this other solution you provided here :
    https://community.theme.co/forums/topic/show-category-descriptions-in-icon-stack/

    and the code

    add_action('x_before_view_global__index', 'icon_archive_title');
    function icon_archive_title () {
    if( is_category() ) : ?>
      <?php $title    = ( $meta['archive-title']    != '' ) ? $meta['archive-title']    : single_cat_title("", false); ?>
      <header class="x-header-landmark x-container max width">
        <h1 class="h-landmark"><span><?php echo $title ?></span></h1>
        <?php echo category_description(); ?>
      </header>
    <?php endif; 
    }

    Does work in functions.php showing the category description as needed but shortcodes still not working.

    #1395859
    kenas
    Participant

    Should i stick to the functions.php method or choose try to figure out why is not working the _index.php in global ?

    I also managed to include the shortcode adding in functions.php the following

    add_filter( 'term_description', 'do_shortcode' );

    So it finally looks something like this :
    https://goo.gl/e9WfFc

    I would still like to center the description and the title, is this possible ?

    #1395881
    Christopher
    Moderator

    Hi there,

    Your methods is correct and category description displays fine.

    Please add following code in Customize -> Custom -> Global CSS :

    h1.h-landmark, header.x-header-landmark.x-container.max.width p {
        text-align: center;
    }

    Hope it helps.

    #1395894
    kenas
    Participant

    Thanks for your help

    #1395896
    Lely
    Moderator

    You’re welcome!

    Cheers.

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