Recent Posts Shortcode Formatting

Support Forums for LiveMesh Themes & Plugins Forums Extinct Theme Support Recent Posts Shortcode Formatting

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #13006

    Hi- 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

    #13037
    Raghavendra
    Moderator

    You 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);
    
    #13073

    Actually, 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.

    http://winnebagoparts2015.manageinfinity.com/specials/

    #13089
    Raghavendra
    Moderator

    If the standards break tags are being used, I would stick with them instead of messing with filters which would affect excerpts everywhere.

    #13104

    I 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.

    #13161

    So, 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.

    #13210
    Veena
    Moderator

    As 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.

    #13225

    I’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.

    #13226

    What about having the shortcode call the_content instead of the_excerpt? Can you tell me where I could do that?

    #13261
    Raghavendra
    Moderator

    Sorry 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.

    #13272

    Tried 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!

    #13273
    #13274

    This also works and is a little cleaner:

    Replace

    $output .= get_the_content();

    with

    $output .= apply_filters( 'the_content', get_the_content() );

    #13286
    Raghavendra
    Moderator

    Glad you were able to get this working. Thanks for letting us know about your findings.

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Recent Posts Shortcode Formatting’ is closed to new replies.