Tagged: x
-
AuthorPosts
-
May 12, 2016 at 8:19 pm #988856
briantbeckerParticipantI’m sorry, I was tired of waiting and needed to fix it someway so I limited it by using a counter. But, I just restored it to the original X-Child function.php so you can see it is still doing the same thing…
Brian
May 12, 2016 at 11:34 pm #989105
Rue NelModeratorHey Brian,
I created a test page in your site. I have compared both the element from Cornerstone and the output of the manual shortcode. You can check it here: http://jerper.staging.wpengine.com/an-x-test/
Hope this helps.
May 13, 2016 at 12:05 am #989129
briantbeckerParticipantRight, it’s doing the same thing… if you view while editing in Cornerstone, it shows 3 at the top (using an element) and 4 in the bottom (using the shortcode). But, save and exit out of Cornerstone and it shows:
3 at the top
7 at the bottomSomething is overriding the WP_Query results when viewing the page and I’m totally confused as to why.
May 13, 2016 at 12:31 am #989151
LelyModeratorHello Brian,
This is because of your sticky post.
Assigning a post to be sticky will make the post always show. that the default behavior of sticky post.
Unfortunately, I can’t login anymore to your hosting via FTP.By default sticky post is set to true. It is set to ON on Cornerstone element and then I’ve updated the shortcode to this:
[x_recent_posts count="3" ignore_sticky_posts ="false"]
It didn’t work for the shortcode. This might be because you’re customization is applied on the old code for recent post wherein sticky post option is not yet added.This is the original current code of recent post :
// Recent Posts // ============================================================================= function x_shortcode_recent_posts( $atts ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', 'style' => '', 'type' => 'post', 'count' => '', 'category' => '', 'offset' => '', 'orientation' => '', // 'show_excerpt' => 'true', 'no_sticky' => '', 'no_image' => '', 'fade' => '' ), $atts, 'x_recent_posts' ) ); $allowed_post_types = apply_filters( 'cs_recent_posts_post_types', array( 'post' => 'post' ) ); $type = ( isset( $allowed_post_types[$type] ) ) ? $allowed_post_types[$type] : 'post'; $id = ( $id != '' ) ? 'id="' . esc_attr( $id ) . '"' : ''; $class = ( $class != '' ) ? 'x-recent-posts cf ' . esc_attr( $class ) : 'x-recent-posts cf'; $style = ( $style != '' ) ? 'style="' . $style . '"' : ''; $count = ( $count != '' ) ? $count : 3; $category = ( $category != '' ) ? $category : ''; $category_type = ( $type == 'post' ) ? 'category_name' : 'portfolio-category'; $offset = ( $offset != '' ) ? $offset : 0; $orientation = ( $orientation != '' ) ? ' ' . $orientation : ' horizontal'; // $show_excerpt = ( $show_excerpt == 'true' ); $no_sticky = ( $no_sticky == 'true' ); $no_image = ( $no_image == 'true' ) ? $no_image : ''; $fade = ( $fade == 'true' ) ? $fade : 'false'; $js_params = array( 'fade' => ( $fade == 'true' ) ); $data = cs_generate_data_attributes( 'recent_posts', $js_params ); $output = "<div {$id} class=\"{$class}{$orientation}\" {$style} {$data} data-fade=\"{$fade}\" >"; $q = new WP_Query( array( 'orderby' => 'date', 'post_type' => "{$type}", 'posts_per_page' => "{$count}", 'offset' => "{$offset}", "{$category_type}" => "{$category}", 'ignore_sticky_posts' => $no_sticky ) ); if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post(); if ( $no_image == 'true' ) { $image_output = ''; $image_output_class = 'no-image'; } else { $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'entry-cropped' ); $bg_image = ( $image[0] != '' ) ? ' style="background-image: url(' . $image[0] . ');"' : ''; $image_output = '<div class="x-recent-posts-img"' . $bg_image . '></div>'; $image_output_class = 'with-image'; } // $excerpt = ( $show_excerpt ) ? '<div class="x-recent-posts-excerpt"><p>' . preg_replace('/<a.*?more-link.*?<\/a>/', '', cs_get_raw_excerpt() ) . '</p></div>' : ''; $output .= '<a class="x-recent-post' . $count . ' ' . $image_output_class . '" href="' . get_permalink( get_the_ID() ) . '" title="' . esc_attr( sprintf( __( 'Permalink to: "%s"', 'cornerstone' ), 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>' // . $excerpt . '</div>' . '</div>' . '</article>' . '</a>'; endwhile; endif; wp_reset_postdata(); $output .= '</div>'; return $output; } add_shortcode( 'x_recent_posts', 'x_shortcode_recent_posts' );You might use this code instead. And then whatever you customization is, please apply it to that code. I want to check it myself but the FTP is not working. I’ve tried using Filezill and Winscp with no success.
Hope this helps.
May 13, 2016 at 1:02 am #989193
briantbeckerParticipantSolved. Thanks!
May 13, 2016 at 1:12 am #989203
Rue NelModeratorYou are most welcome!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-985898 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
