Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1390989
    worldofjames
    Participant

    Hi there

    Not sure if this is doable or not! My site yorkshiresbestadventures.co.uk uses an essential grid to display posts on the homepage. I’d like all my category and tag archives to look the same, but filter out the posts depending on the category.

    In other words, I’d like these types of pages

    http://yorkshiresbestadventures.co.uk/activity/yorkshire/family/

    to have the same look as the entries on the homepage

    #1391416
    Rupok
    Member

    Hi there,

    You can filter the posts based on category and tags. Kindly follow the Essential Grid documentation – https://www.themepunch.com/essgrid-doc/essential-grid-documentation/

    Thanks!

    #1391544
    worldofjames
    Participant

    Hi – thanks… Yes, I know you can filter to make grids. But how do I replace the existing category/tag archive page with the new Essential Grid I create?

    #1391619
    Christian
    Moderator

    Please see https://www.themepunch.com/faq/auto-populate-grid-for-blog-pages-with-the-loop-advanced/ for instructions. Also note that this since this requires theme modification, issues arising from the use of or further functionality changes would be outside the scope of our support. You might also want to learn the best practices for customizing X here https://community.theme.co/kb/customization-best-practices/

    Thanks.

    #1391799
    worldofjames
    Participant

    Thanks Christian – great stuff.

    #1391816
    Joao
    Moderator

    🙂

    #1401818
    worldofjames
    Participant

    Hi guys

    Sorry to come back to this but I’ve only just plucked up the guts to try it.

    According to the Essential Grid documentation, I need to alter the category.php and tag.php files to do this.

    I can’t seem to locate them in the original X install to copy into my child theme and make the changes.

    Can you let me know where to look for them please?

    Many thanks
    James

    #1402459
    Rad
    Moderator

    Hi there,

    You’ll have to create them, X doesn’t use them but there is no restriction that you can’t use them. You can duplicate index.php and all other files associated with it, then rename it to category.php. It’s the same, you can also try other alternatives given here https://community.theme.co/forums/topic/display-one-category-separately/

    The important part is where the while() query loop is, the documentation only refer those templates since they are common and built-in to default themes such as Twentyeleven and similar. You can still use the same index.php, but you just need to include your code within is_category() block condition.

    Would you mind providing the documentation you’re referring to category.php? Maybe I could provide some simply code without the need for full template customization.

    Thanks!

    #1402781
    worldofjames
    Participant
    #1403259
    Rad
    Moderator

    Hi there,

    Thanks, please create a file _index.php under your child theme’s folder at /x-child/framework/views/global/ and add this code

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_INDEX.PHP
    // -----------------------------------------------------------------------------
    // Includes the index output.
    // =============================================================================
    
    $stack = x_get_stack();
    
    ?>
    
    <?php if( is_category() || is_tag() ) : 
    
    $my_post_array = array();
    
      if ( have_posts() ) {
    
          while ( have_posts() ) { 
    
            the_post();
    
            $my_post_array[] = get_the_ID();
    
          }
      
      echo do_shortcode( '[ess_grid alias="even_grid_adams" posts='.implode(',', $my_post_array).']' );
    
      }
    
    ?>
    
    <?php else : 
    
    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 ) : ?>
    
      <?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 endif; ?>
    
    <?php pagenavi(); ?>

    Hope this helps.

    #1403581
    worldofjames
    Participant

    Hi Rad

    Thanks for doing that… that worked brilliantly.

    You are a star

    James

    #1403651
    Rue Nel
    Moderator

    Hey James,

    You’re welcome! We are just glad we were able to help you out.
    Thanks for letting us know that it has worked for you.

    Cheers.

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