Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1272055
    wt
    Participant

    Hello there,

    I’m using a standard blog layout to display a post tittle, featured image and post description on the category view with ethos. The description has been displayed before but now no description is displayed together with the featured image and the tittle (only the tittle is displayed). Can anyone help why this is happening and how to fix this issue?
    Thanks!

    #1272058
    Christopher
    Moderator

    Hi there,

    Featured images and post titles are displaying fine on archive pages. To display excerpt change archive layout to standard.

    Hope it helps.

    #1272061
    wt
    Participant
    This reply has been marked as private.
    #1272065
    Christopher
    Moderator

    Hi there,

    Upon checking your site,excerpt was displaying fine. Please see the attachment.

    Thanks.

    #1272069
    wt
    Participant

    If you see recent posts, its not displayed, this is the issue I do have

    #1272071
    Christopher
    Moderator

    Hi there,

    Are you referring to latest posts on sidebar? Please insert recent posts shortcode in text element, see https://demo.theme.co/integrity-1/shortcodes/recent-posts

    By default recent posts element doesn’t display excerpt. To enable excerpt, please add following code in child theme’s functions.php file :

    // =============================================================================
    function x_shortcode_recent_posts_v2code( $atts ) {
      extract( shortcode_atts( array(
        'id'          => '',
        'class'       => '',
        'style'       => '',
        'type'        => '',
        'count'       => '',
        'category'    => '',
        'enable_excerpt' => '',
        'offset'      => '',
        'orientation' => '',
        'no_image'    => '',
        'fade'        => ''
      ), $atts ) );
    
      $id            = ( $id          != ''          ) ? 'id="' . esc_attr( $id ) . '"' : '';
      $class         = ( $class       != ''          ) ? 'x-recent-posts cf ' . esc_attr( $class ) : 'x-recent-posts cf';
      $style         = ( $style       != ''          ) ? 'style="' . $style . '"' : '';
      $type          = ( $type        == 'portfolio' ) ? 'x-portfolio' : 'post';
      $count         = ( $count       != ''          ) ? $count : 3;
      $category      = ( $category    != ''          ) ? $category : '';
      $category_type = ( $type        == 'post'      ) ? 'category_name' : 'portfolio-category';
      $offset        = ( $offset      != ''          ) ? $offset : 0;
      $orientation   = ( $orientation != ''          ) ? ' ' . $orientation : ' horizontal';
      $no_image      = ( $no_image    == 'true'      ) ? $no_image : '';
      $fade          = ( $fade        == 'true'      ) ? $fade : 'false';
      $enable_excerpt = ( $enable_excerpt == 'true'      ) ? true : false;
    
      $output = "<div {$id} class=\"{$class}{$orientation}\" {$style} data-fade=\"{$fade}\">";
    
        $q = new WP_Query( array(
          'orderby'          => 'date',
          'post_type'        => "{$type}",
          'posts_per_page'   => "{$count}",
          'offset'           => "{$offset}",
          "{$category_type}" => "{$category}"
        ) );
    
        if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();
    
          if ( $no_image == 'true' ) {
            $image_output       = '';
            $image_output_class = 'no-image';
          } else {
            $image_output       = '<div class="x-recent-posts-img">' . get_the_post_thumbnail( get_the_ID(), 'entry-' . get_theme_mod( 'x_stack' ) . '-cropped', NULL ) . '</div>';
            $image_output_class = 'with-image';
          }
    
          $output .= '<a class="x-recent-post' . $count . ' ' . $image_output_class . '" href="' . get_permalink( get_the_ID() ) . '" title="' . esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ) . '">'
                     . '<article id="post-' . get_the_ID() . '" class="' . implode( ' ', get_post_class() ) . '">'
                       . '<div class="entry-wrap">'
                         . $image_output
                         . '<div class="x-recent-posts-content">'
                           . '<h3 class="h-recent-posts">' . get_the_title() . '</h3>'
                           . '<span class="x-recent-posts-date">' . get_the_date() . '</span>'
                           . ( $enable_excerpt ? '<span class="x-recent-posts-excerpt">' . strip_tags( get_the_excerpt() ) . '</span>' : '' )
                           
                         . '</div>'
                       . '</div>'
                     . '</article>'
                   . '</a>';
    
        endwhile; endif; wp_reset_postdata();
      
      $output .= '</div>';
    
      return $output;
    }
    
    add_action('wp_head', 'change_recent_posts_to_v2');
    
    function change_recent_posts_to_v2() {
      remove_shortcode( 'x_recent_posts' );
      add_shortcode( 'x_recent_posts', 'x_shortcode_recent_posts_v2code' );
    }

    Now add enable_excerpt="true" attribute to your shortcode :

    [x_recent_posts count="3" enable_excerpt="true"]

    Hope it helps.

    #1272076
    wt
    Participant

    Thank you Christian for the help, however no I’m not talking the recent post on the sidebar. What I mean is the posts I recently making on my website. Please check this out:https://ethiobook.net/category/journals/english/

    #1272077
    wt
    Participant

    Sorry I miss-spelled your name to mean Christopher…

    #1272387
    Rad
    Moderator

    Hi there,

    You mean the “Tweet” displaying as the excerpt? WordPress will strip out HTML and shortcodes when generating excerpt, if your content is created in a builder then it will display block.

    In this case, WordPress has a feature that you can use to manually add your text excerpt.

    1. Please edit your post and scroll up then click Screen Options.
    2. Toggle on Excerpt
    3. Scroll down and find Excerpt section
    4. Then manually add your excerpt

    Hope this helps.

    #1280437
    wt
    Participant

    Thanks, got it!

    #1280472
    Thai
    Moderator

    You’re most welcome 🙂

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