-
AuthorPosts
-
July 25, 2021 at 2:48 am #1312134
Hi, is there any way to show the full content of posts via the Post Slider element? My client wants a slider for their team, with each slide showing a headshot on the left, a couple of paragraphs (with titles) on the right, and a button below the paragraphs — so I’m looking for a slider that lets me use the Advanced Layout Editor. Maybe there’s a snippet I could add to my child theme to let the Post Slider show the full content, instead of just excerpts? Thanks and let me know if you have any questions!
July 27, 2021 at 9:22 am #1312659Hey sky19er,
Thank you for the inquiry.
Have you tried using the Content Slider element? You can insert shortcodes and create your own markup in each slider. Unfortunately, there is no slider in the theme where you can use the advance layout builder to create the content of the slide.
Best regards,
IsmaelJuly 27, 2021 at 8:22 pm #1312847Thanks, Ismael. I did try the Content Slider, but, for one, the shortcode wizard in there uses a limited list — there’s no option.for columns in there, and it doesn’t look like using the column shortcode works in that element. Plus, using shortcode makes it hard for the client to make updates themselves. And also, the arrows for that element are not so hot — I much prefer the arrows in the post slider. But if you don’t have (or want to create) a snippet I could add to my child theme to make the post slider show full posts, I totally understand — just let me know. I guess I’d probably go with a third party slider plugin, like Smart Slider, then. Thanks again, Ismael — I always appreciate for your help!
August 2, 2021 at 4:09 am #1313783Hi,
Yes, the shortcode in the content slider is quite limited and adding shortcodes manually may not be what your client wanted. We could use the avf_post_slider_entry_excerpt filter to return the actual content of the post entry instead of the excerpt.
function avf_post_slider_entry_excerpt_custom($excerpt, $prepare_excerpt, $permalink, $entry ) { $excerpt = $entry->post_content; return $excerpt; } add_filter('avf_post_slider_entry_excerpt', 'avf_post_slider_entry_excerpt_custom', 10, 4);
This should display the full content of the posts in the post slider element, but it may require some css or style adjustments.
Best regards,
IsmaelAugust 2, 2021 at 7:01 am #1313825Nice! Now (and I’m sorry to keep pushing on this) is there a way to tweak that so it works with the Advanced Layout Editor in the posts? It seems to be showing all the shortcode when I use the Advanced Layout Editor in the post (see https://fpamed.com/home-team-slider-test/ ). Also, I can hide the featured images with css, but if there’s an easy way to hide those in the function, that’d be awesome. Thanks again, Ismael!
August 4, 2021 at 6:53 am #1314277Hi,
is there a way to tweak that so it works with the Advanced Layout Editor in the posts?
That is not possible, unfortunately. Rendering the shortcodes will break the post slider. The modification above will only work if the posts have been created using the default editor.
Best regards,
IsmaelAugust 4, 2021 at 7:21 am #1314284Fair enough — thanks again, Ismael!
August 5, 2021 at 12:53 am #1314522Hi,
Did you need additional help with this topic or shall we close?
Best regards,
Jordan ShannonAugust 5, 2021 at 2:58 am #1314545Actually, Ismael, sorry, it looks like — even if I use the default editor — the shortcode in the default editor’s not working, so I can’t do the columns or add a button: https://fpamed.com/home-team-slider-test/ — Is there any way to get the Post Slider to process shortcode in the default editor?
- This reply was modified 3 years, 3 months ago by sky19er.
August 7, 2021 at 6:36 am #1314991Hi,
In the avf_post_slider_entry_excerpt filter above, try to wrap the $excerpt or the $entry->post_content in a do_shortcode function. This should render the shortcodes in the default editor properly
// https://developer.wordpress.org/reference/functions/do_shortcode/
Rendering of shortcodes are not allowed by default because there is a great chance that it will break the layout of the page if not done correctly.
Best regards,
IsmaelAugust 7, 2021 at 7:58 am #1315001Yes — that worked!
return do_shortcode($excerpt);
I think the only thing left is that It’s still outputting like an excerpt in that it doesn’t seem to register paragraphs — I can probably work around that with dividers and/or css, but if you know how to get it to register paragraphs that’d be perfect. Thanks again, Ismael.August 9, 2021 at 3:49 am #1315187Hi,
You might be able to use the wpautop function to automatically create paragraph tags, or to automatically convert line breaks to paragraph tags.
// https://developer.wordpress.org/reference/functions/wpautop/
Best regards,
IsmaelAugust 9, 2021 at 7:24 am #1315228That worked! So here’s the complete function to pull the full content of posts into the post slider, process the shortcode, and add paragraph breaks:
function avf_post_slider_entry_excerpt_custom($excerpt, $prepare_excerpt, $permalink, $entry ) { $excerpt = $entry->post_content; return do_shortcode(wpautop($excerpt)); } add_filter('avf_post_slider_entry_excerpt', 'avf_post_slider_entry_excerpt_custom', 10, 4);
Thanks again, Ismael — I repeat: you’re the man!
August 10, 2021 at 7:37 am #1315971 -
AuthorPosts
- The topic ‘post slider show full content’ is closed to new replies.