Tagged: x
-
AuthorPosts
-
November 2, 2016 at 6:26 am #1240581
mathijs84ParticipantHi,
On http://www.socure.work-planning.com/
I have a section with recent blog posts. The blog post has no image.
Can i modify the no pic image that is shown??
November 2, 2016 at 7:20 am #1240630
ThaiModeratorRegretfully, at this time I am not entirely certain what it is you would like to accomplish based on the information given in your post. If you wouldn’t mind providing us with a little more clarification on what it is you’re wanting to do (a link to a similar example site would be very helpful, or perhaps some screenshots), we’ll be happy to provide you with a response once we have a better understanding of the situation.
November 2, 2016 at 8:44 am #1240731
mathijs84ParticipantSorry,
I mean this section: http://prnt.sc/d24u02
There is no picture in the blog, so it shows a red image instead. Can i change that image to for example the logo ?
November 2, 2016 at 10:02 am #1240851
JoaoModeratorThanks for writing in!
Try adding following CSS under Appearance > Customize > Custom > CSS:.entry-thumb:before { content: "View More"; padding: 0 15px; margin: -36px 0 0 -87px; width: auto; font-family: "Lato","Helvetica Neue",Helvetica,sans-serif; font-size: 3rem; }You can replace the “View More” with your text, image or a different icon.
Hope it helps.
November 11, 2016 at 4:35 am #1253134
mathijs84ParticipantOk , i got this working but i have another request
Is it possible to make the recent posts the same as how the posts are displayed on the blog page.
So on the homepage, where we use the recent posts element instead of this: http://prnt.sc/d5vul0
You see this: http://prnt.sc/d5vugq
Thanks!!
November 11, 2016 at 7:37 am #1253289
Paul RModeratorHi,
Yes, that’s possible.
You can add this in your child theme’s functions.php file.
function x_shortcode_recent_posts_v3( $atts ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', 'style' => '', 'type' => 'post', 'count' => '', 'category' => '', 'offset' => '', 'orientation' => '', 'show_excerpt' => 'false', '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 ) ); $cat = ""; 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>' : ''; $categories = get_the_category(); if(isset($categories[0])){ $cat = $categories[0]->name; echo $cat; } $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">' . '<div class="x-recent-posts-content">' . '<h3 class="h-recent-posts">' . get_the_title() . '</h3>' . $excerpt . '</div>' . '</div>' . '</article>' . '</a>'; endwhile; endif; wp_reset_postdata(); $output .= '</div>'; return $output; } // ============================================================================= add_action('wp_head', 'change_recent_posts_to_v3'); function change_recent_posts_to_v3() { remove_shortcode( 'x_recent_posts' ); add_shortcode( 'x_recent_posts', 'x_shortcode_recent_posts_v3' ); } // =============================================================================Then use this code to display your recent post.
[x_recent_posts count="2" show_excerpt="true"]Hope that helps.
November 11, 2016 at 12:31 pm #1253615
mathijs84ParticipantWow thats great thanks!!
Can i change it a little please??
I changed it and you can see the results on the homepage:– Can we not show the part that says: UncategorizedUncategorized
– CAn we make the 2 sections the same height
– all the font black
November 11, 2016 at 3:02 pm #1253729
JoaoModeratorHi There,
I dont see anything like UncategorizedUncategorized
Can you clarify?
Thanks
Joao
November 12, 2016 at 1:05 am #1254243
mathijs84ParticipantSee attached file!!
So please:
– Can we not show the part that says: UncategorizedUncategorized
– CAn we make the 2 sections the same height
– all the font black
November 12, 2016 at 1:18 am #1254247
Rue NelModeratorHello There,
Thanks for the updates!
1] I am not seeing this in your site. Can you please provide the url where we can find this?
2] The height relies on the amount of content. As you resize your browser, the paragraph text will adjust and fall to the next rows. This is why it would differ in height.
3] To make the colors to all black, please add the following css code in the customizer, Appearance > Customize > Custom > CSS
.entry-content p { color: black; }Hope this helps.
November 14, 2016 at 2:12 am #1256003
mathijs84Participantsorry, we went live on http://www.socure.nl
could you please check for
– Can we not show the part that says: UncategorizedUncategorized
– CAn we make the 2 sections the same height, strangely if you make your screen bigger.. the height is not the same anymore
November 14, 2016 at 2:23 am #1256016
ChristopherModeratorHi there,
Please implement the code so we can see the issues.
Thanks.
November 14, 2016 at 2:43 am #1256031
mathijs84ParticipantIt is implemented!!
November 14, 2016 at 2:44 am #1256034
mathijs84ParticipantSee the homepage on http://www.socure.nl/ at the bottem!
The black font is fixed..
November 14, 2016 at 3:04 am #1256055
ChristopherModeratorHi there,
Please update your code in child theme’s functions.php file to :
function x_shortcode_recent_posts_v3( $atts ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', 'style' => '', 'type' => 'post', 'count' => '', 'category' => '', 'offset' => '', 'orientation' => '', 'show_excerpt' => 'false', '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 ) ); $cat = ""; 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">' . '<div class="x-recent-posts-content">' . '<h3 class="h-recent-posts">' . get_the_title() . '</h3>' . $excerpt . '</div>' . '</div>' . '</article>' . '</a>'; endwhile; endif; wp_reset_postdata(); $output .= '</div>'; return $output; } // ============================================================================= add_action('wp_head', 'change_recent_posts_to_v3'); function change_recent_posts_to_v3() { remove_shortcode( 'x_recent_posts' ); add_shortcode( 'x_recent_posts', 'x_shortcode_recent_posts_v3' ); } // =============================================================================Please add following code in Customize -> Custom -> Global CSS :
.home .x-recent-posts > a { height: 207px; overflow: hidden; }Hope it helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1240581 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
