Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1254236

    troyassoignon
    Participant

    I’ve read all of the form questions, added the code to the functions.php and used the most recent code I could find.

    [recent_posts type="post" count="3" offset="0" orientation="horizontal" enable_excerpt="true" no_image="true" fade="true"]

    http://ethicalempire.ca/trusted/

    Please help πŸ™‚

    #1254239

    Christopher
    Moderator

    Hi there,

    Please your code in child theme’s functions.php file to :

    // =============================================================================
    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' );
    }

    Update your shortcode to :

    [x_recent_posts type="post" count="3" offset="0" orientation="horizontal" enable_excerpt="true" no_image="true" fade="true"]

    Hope it helps.

    #1254539

    troyassoignon
    Participant

    Thanks for the response.

    Changed it all, still no excerpt πŸ™

    #1254857

    Rue Nel
    Moderator

    Hello There,

    To assist you better with this issue, would you mind providing us the url of your site with login credentials so we can take a closer look? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    To do this, you can make a post with the following info:
    – Link to your site

    – WordPress Admin username / password

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

    Thank you.

    #1255896

    troyassoignon
    Participant
    This reply has been marked as private.
    #1255923

    Darshana
    Moderator
    This reply has been marked as private.
    #1397382

    troyassoignon
    Participant

    Hello, yes I can. One moment.3 months later lol. Sorry for the delay this project got put on hold.

    #1397414

    troyassoignon
    Participant
    This reply has been marked as private.
    #1397517

    Christopher
    Moderator

    Hi there,

    There are many folders in your host, which one belong to current site?

    Thanks.

    #1403011

    troyassoignon
    Participant

    /trusted/ for this one

    #1403337

    Rad
    Moderator

    Hi there,

    Please remove the fade="true" attribute. It’s onl applicable if your content is long.

    Thanks!

    #1404133

    troyassoignon
    Participant

    Perfect! Is there a way to make them a set height??

    #1404134

    troyassoignon
    Participant

    And also a set width?

    #1404402

    Paul R
    Moderator

    Hi,

    To set a height and width, you can add this in Cornerstone > Settings > Custom CSS (https://www.screencast.com/t/UIPW7GRa )

    
    #x-section-2 .x-recent-posts a {
        width: 100%;
    }
    
    #x-section-2  span.x-recent-posts-excerpt {
        min-height: 200px;
        display: block;
    }
    

    You may change 200px to adjust the height.

    Hope that helps.

    #1404634

    troyassoignon
    Participant

    Thank you Paul, Added custom CSS yet Didn’t change anything.

    I’d like the headline to show and maybe the first 2-3 lines of text.

    Please see screenshot