Tagged: x
-
AuthorPosts
-
November 12, 2016 at 12:41 am #1254236
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 π
November 12, 2016 at 12:49 am #1254239Hi 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.
November 12, 2016 at 12:19 pm #1254539Thanks for the response.
Changed it all, still no excerpt π
November 12, 2016 at 7:53 pm #1254857Hello 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 / passwordDonβt forget to select Set as private reply. This ensures your information is only visible to our staff.
Thank you.
November 13, 2016 at 11:53 pm #1255896This reply has been marked as private.November 14, 2016 at 12:31 am #1255923This reply has been marked as private.March 7, 2017 at 2:39 am #1397382Hello, yes I can. One moment.3 months later lol. Sorry for the delay this project got put on hold.
March 7, 2017 at 3:15 am #1397414This reply has been marked as private.March 7, 2017 at 4:48 am #1397517Hi there,
There are many folders in your host, which one belong to current site?
Thanks.
March 11, 2017 at 6:55 am #1403011/trusted/ for this one
March 11, 2017 at 4:48 pm #1403337Hi there,
Please remove the
fade="true"
attribute. It’s onl applicable if your content is long.Thanks!
March 12, 2017 at 7:38 pm #1404133Perfect! Is there a way to make them a set height??
March 12, 2017 at 7:42 pm #1404134And also a set width?
March 13, 2017 at 12:18 am #1404402Hi,
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.
March 13, 2017 at 5:11 am #1404634Thank 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
-
AuthorPosts