Support Forums for LiveMesh Themes & Plugins › Forums › Extinct Theme Support › Recent Posts Shortcode Formatting
- This topic has 13 replies, 3 voices, and was last updated 9 years, 11 months ago by
Raghavendra.
-
AuthorPosts
-
March 25, 2015 at 6:16 pm #13006
treviscarletta
MemberHi- Great theme, very easy to use so far. I really appreciate all of the attention to detail you paid on the styles of everything—looks really nice.
I’m using the Recent Posts shortcode to create a page of product specials and it’s working great, except the formatting seems to get stripped when it’s output to the page: http://winnebagoparts2015.manageinfinity.com/specials/
It’s crunching everything into one paragraph and not including the linebreaks of the post. Is there a way to prevent that from happening?
Thanks!
-Trevis
March 27, 2015 at 1:43 pm #13037Raghavendra
ModeratorYou require a little bit of code to be written to achieve this since WordPress does not allow tags in excerpt by default. Pls have a look at this post –
http://wordpress.stackexchange.com/questions/141125/allow-html-in-excerpt
http://wordpress.stackexchange.com/questions/112503/how-to-include-html-in-excerpts
Pls let me know if you need more information. Also, you will need to change framework/functions/post-functions.php line number 372 to –
$excerpt_text = mo_truncate_string(get_the_excerpt(), $excerpt_count, false);
March 28, 2015 at 8:40 pm #13073treviscarletta
MemberActually, now that I rethink it, it’s allowing some formatting in the excerpts already, but it’s not breaking paragraphs. When I add a <br /> tag it breaks, but the standard WP breaks are being stripped it seems.
March 30, 2015 at 12:54 pm #13089Raghavendra
ModeratorIf the standards break tags are being used, I would stick with them instead of messing with filters which would affect excerpts everywhere.
March 31, 2015 at 12:05 am #13104treviscarletta
MemberI get what you’re saying but, I’m not worried about the risk. I’d rather use a filter than have to teach my client how to use <br /> tags.
April 2, 2015 at 9:26 pm #13161treviscarletta
MemberSo, from what I can tell after looking into this, wpautop is active by default in post excerpts. But in Extinct, it is disabled in the recent posts shortcode excerpt. Can you tell me where I can re-enable that? I’ve been looking and can’t seem to figure out where that is.
Thanks.
April 4, 2015 at 7:56 am #13210Veena
ModeratorAs of our knowledge we haven’t deactivated the p tag, WordPress itself is modifying.
Can you pls try this Advanced Excerpt plugin –
https://wordpress.org/plugins/advanced-excerpt/screenshots/
Hope this will help your work.April 4, 2015 at 9:59 pm #13225treviscarletta
MemberI’ve installed the plugin and tried several different combinations of settings and it didn’t help.
The strange thing is, I can only find filters to disable the wpautop function, as if it’s the default in WordPress, so it’s confusing that WordPress is modifying it on its own and it’s now disabled. A search on Google tells me several ways to disable it, but not how to enable it.
April 5, 2015 at 1:22 am #13226treviscarletta
MemberWhat about having the shortcode call the_content instead of the_excerpt? Can you tell me where I could do that?
April 7, 2015 at 1:35 pm #13261Raghavendra
ModeratorSorry to hear you are still facing this issue. To try get_the_content(), I guess it would be same place as get_the_excerpt function call in framework/functions/post-functions.php line number 372.
April 7, 2015 at 6:34 pm #13272treviscarletta
MemberTried that, it’s still stripping the
<p>
tags and mashing the content together.I tried adding the filter below to the functions.php file, but that didn’t help either.
add_filter( 'get_the_content', 'wpautop' );
I appreciate your assistance… This is the last thing I need to adjust on this site before it’s done and it’s driving me up the wall!
April 7, 2015 at 7:00 pm #13273treviscarletta
MemberFound a solution: http://www.web-templates.nu/2008/08/31/get_the_content-with-formatting/
April 7, 2015 at 7:17 pm #13274treviscarletta
MemberThis also works and is a little cleaner:
Replace
$output .= get_the_content();
with
$output .= apply_filters( 'the_content', get_the_content() );
April 8, 2015 at 1:17 pm #13286Raghavendra
ModeratorGlad you were able to get this working. Thanks for letting us know about your findings.
-
AuthorPosts
- The topic ‘Recent Posts Shortcode Formatting’ is closed to new replies.