Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1027678
    Catherine R
    Participant

    hi, I love the way the Index Featured Post Layout looks, but my client is really set on including a short excerpt. Is this possible?
    Ethos stack

    thanks!

    #1027892
    Paul R
    Moderator

    Hi,

    Thanks for writing in!

    Yes, it’s possible.

    To achieve that, create file content-image.php in wp-content/themes/x-child/framework/views/ethos
    and copy the code below into that file

    
    <?php
    
    // =============================================================================
    // VIEWS/ETHOS/CONTENT-IMAGE.PHP
    // -----------------------------------------------------------------------------
    // Image post output for Ethos.
    // =============================================================================
    
    $is_index_featured_layout = get_post_meta( get_the_ID(), '_x_ethos_index_featured_post_layout', true ) == 'on' && ! is_single();
    
    ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
      <?php if ( $is_index_featured_layout ) : ?>
        <?php x_ethos_featured_index(); ?>
        
        <div class="excerpt"><?php the_excerpt(); ?></div>
      <?php else : ?>
        <?php if ( has_post_thumbnail() ) : ?>
          <div class="entry-featured">
            <?php if ( ! is_single() ) : ?>
              <?php x_ethos_featured_index(); ?>
            <?php else : ?>
              <?php x_featured_image(); ?>
            <?php endif; ?>
          </div>
        <?php endif; ?>
        <div class="entry-wrap">
          <?php x_get_view( 'ethos', '_content', 'post-header' ); ?>
          <?php x_get_view( 'global', '_content' ); ?>
        </div>
      <?php endif; ?>
    </article>
    

    Hope that helps

    #1029843
    Catherine R
    Participant

    hi themeco, thank you for your advice. child theme/.php all set up, but I see no difference.

    the page is made up of one category out of the posts;
    index featured post layout is checked
    skinny is checked
    excerpt is filled in.

    in the customiser under Blog, full post comment on index is off, with an excerpt length of 30.

    advice? thank you!

    #1030141
    Rupok
    Member

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    #1030642
    Catherine R
    Participant

    Dear Themeco,
    I’m going to send this on in about 2 weeks time. the site is now on a localhost and I’ll be moving & testing it around the 20th.
    Please keep the thread open, I’ll definitely send on the information! thank you.

    #1031372
    Paul R
    Moderator

    You’re welcome! 🙂

    #1050397
    Catherine R
    Participant
    This reply has been marked as private.
    #1050469
    Christopher
    Moderator

    Hi there,

    Please copy _index-featured.php from framework/views/ethos and put it in the same path inside child theme, replace existing code with following :

    <?php
    
    // =============================================================================
    // VIEWS/ETHOS/_INDEX-FEATURED.PHP
    // -----------------------------------------------------------------------------
    // Featured content output for the index pages.
    // =============================================================================
    
    $index_layout           = get_post_meta( get_the_ID(), '_x_ethos_index_featured_post_layout',  true );
    $class                  = ( $index_layout == 'on' ) ? 'featured' : '';
    $background_image_style = x_ethos_entry_cover_background_image_style();
    $categories             = x_ethos_post_categories();
    
    ?>
    
    <a href="<?php the_permalink(); ?>" class="entry-thumb <?php echo $class; ?>" style="<?php echo $background_image_style; ?>">
      <?php if ( $index_layout == 'on' && ! is_single() ) : ?>  
        <span class="featured-meta"><?php echo $categories; ?> / <?php echo get_the_date( 'F j, Y' ); ?></span>
        <h2 class="h-featured"><span><?php the_title(); ?></span></h2>
         <div class="excerpt"><?php the_excerpt(); ?></div>
        <span class="featured-view"><?php _e( 'View Post', '__x__' ); ?></span>
      <?php else : ?>
        <span class="view"><?php _e( 'View Post', '__x__' ); ?></span>
      <?php endif; ?>
    </a>

    Hope it helps.

    #1052462
    Catherine R
    Participant

    hi, I tried this, but it is still not pulling up. I also deleted (but saved on my computer) the _index-featured.php file in the X portion. The above file is in child > framework > views > ethos.

    thank you for your help.

    #1053251
    Friech
    Moderator

    Hi There,

    Please add this on your child theme’s functions.php file instead.

    // Featured Index Content
    // =============================================================================
    
    if ( ! function_exists( 'x_ethos_featured_index' ) ) :
      function x_ethos_featured_index() {
    
        $entry_id                    = get_the_ID();
        $index_featured_layout       = get_post_meta( $entry_id, '_x_ethos_index_featured_post_layout', true );
        $index_featured_size         = get_post_meta( $entry_id, '_x_ethos_index_featured_post_size', true );
        $index_featured_layout_class = ( $index_featured_layout == 'on' ) ? ' featured' : '';
        $index_featured_size_class   = ( $index_featured_layout == 'on' ) ? ' ' . strtolower( $index_featured_size ) : '';
        $is_index_featured_layout    = $index_featured_layout == 'on' && ! is_single();
    
        ?>
    
          <a href="<?php the_permalink(); ?>" class="entry-thumb<?php echo $index_featured_layout_class; echo $index_featured_size_class; ?>" style="<?php echo x_ethos_entry_cover_background_image_style(); ?>">
            <?php if ( $is_index_featured_layout ) : ?>
              <span class="featured-meta"><?php echo x_ethos_post_categories(); ?> / <?php echo get_the_date( 'F j, Y' ); ?></span>
              <h2 class="h-featured"><span><?php x_the_alternate_title(); ?></span></h2>
               <div class="excerpt"><?php the_excerpt(); ?></div>
              <span class="featured-view"><?php _e( 'View Post', '__x__' ); ?></span>
            <?php else : ?>
              <span class="view"><?php _e( 'View Post', '__x__' ); ?></span>
            <?php endif; ?>
          </a>
    
        <?php
    
      }
    endif;
    

    Hope it helps, Cheers!

    #1054662
    Catherine R
    Participant

    thank you, this did work.
    I initially replaced the functions.php instead of adding. Once I added all went fine.

    One very detailed question: is it possible to define the excerpt (ONLY for this, one category, and not for the entire news section)?

    I can add it in the excerpt with this <span style=”color: #fff; font-size: 17px;”> but that is not a user-friendly for my client. thank you.

    #1055257
    Rad
    Moderator

    Hi there,

    You mean that excerpt shouldn’t display at all, except on a specific category? If yes, then you may change this line,

    <div class="excerpt"><?php the_excerpt(); ?></div>

    to this

    <div class="excerpt"><?php if ( is_category( array( 12, 13, 212) ) ) the_excerpt(); ?></div>

    Where 12, 13, 212 are the category IDs.

    As for styling, you can add something like this on your customizer’s custom CSS.

    a .excerpt {
    color: #fff;
    font-size: 17px;
    }

    Hope this helps.

    #1056158
    Catherine R
    Participant

    you guys are the best. thank you!

    #1056327
    Paul R
    Moderator

    You’re welcome! 🙂

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