To insert code use <code>...</code>.
Preserve post formatting when using [blog] shortcode?
  • Hi, I'm using the [blog] shortcode to display content from several different posts on one parent page. A lot of the post content is formatted with HTML tags and Striking shortcodes.

    My problem is that all of the formatting is lost when pulled onto the parent page. Not even or
    formatting is preserved. Everything is lumped together in one big paragraph.

    Is this a limitation of the [blog] shortcode, or am I doing something wrong?

    Thanks!
    D
  • 6 Comments sorted by
  • hi dpan

    I think we need some page links, or at least you adding some images to your post with some markup to illustrate your concerns.

    From the sounds of it, you have chosen to display the full blog posts on the blog index page per the option found in the Striking Blog panel.

    But it sounds to me like perhaps it may be how the blog shortcode is being implemented on the blog index page - did you remember as well to go to your reading settings in the wp admin and set a page to be your blog index page?

    Please post images of your reading settings, your striking blog panel settings, the edit page screen of your blog page so we can see how you implemented the blog shortcode to have the blog posts show up on the page you have designated as your blog page, and the page itself as a visitor is seeing it currently with those settings.

    Thanks. It sounds like implementation.

    Best Regards
    Striking Team
    James

  • Hi James, Dpan,

    I Can confirm that the posts display correctly in FULL mode. However in excerpt mode the formatting is removed, which i think should be and is correct. I even think it is default wordpress behaviour. However it would be nice if we had a toggle for that because in some cases i would like to choose if filter is applied to the excerpt.

    I used this code


    <h1>Excerpt Blog List</h1>

    [blog imageType="default"]

    <h1>Full Blog List</h1>

    [blog imageType="default" full="true"]

    Best regards,
    Striking Team
    Paul
  • Hi James & Paul, thanks for your comments.

    James, you're right that I didn't have a blog page selected, and that the formatting shows up when I do. But I have two problems with this: 1) I want to do this on two separate pages and 2) I don't want the full blog post, only an excerpt. Paul's comment makes me think this formatting issue might be a basic limitation of the blog excerpt functionality.

    The page (crrp.starfruitdigital.com/properties) is to show a group of property photos and basic info, and click through to the individual property posts. I used this code:

    [blog count="20" posts="205,213,219,245,247,203" imageType="left" width="300" height="210" meta="false" desc_length="40" more="true"]

    I tried implementing this with Portfolio items instead of Blog posts...

    [portfolio column="1" height="180" layout="sidebar" sortable="true" ids="575,587,588" desc_length="103"]

    ...but couldn't get the image width to behave correctly, as it width doesn't seem to be an argument in the portfolio shortcode.

    Any suggestions would be most welcome! Thanks again.
    Dave
  • Hi Dave

    There is no width option in the portfolio shortcode. It is determined by the number of columns used.

    It works the other way around.

    So once set the number of columns and height you know the used width (you can figure that one out by looking into the page code) and adjust the images to that size.

    I have no solution for the formatting of the excerpt blog index list.

    Best regards,
    Striking Team
    Paul
  • Hi Paul,

    OK, so now I'm trying to use the Portfolio index, where HTML is preserved using manual excerpts:

    Unfortunately, to have the same index formatting in the individual Portfolio item, it seems I need to maintain the same (HTML-formatted text) in the item's text editing box.

    This becomes a lot of duplicate effort as the number of items and changes increases. Is there any way to avoid this by somehow:

    - Something like turning on "Display Full Posts" in Portfolio index (as one can with Blog index)?
    - Preserving HTML formatting in automatic excerpts?
    - Letting the Portfolio item draw from the manual excerpt?

    Seems like some kind of workaround should be possible! ;-)
  • I think we are talking about different things here.

    I answered on the image cropping. The formatting of the excerpt i already answered upon and i cannot change.

    when you open the loop.php a function is called the_excerpt() on line 78. The same function is called in the portfolio etc files.

    You will have to dive into the wordpress function reference to rewrite that function in order to get things to work the way you want.

    https://codex.wordpress.org/Function_Reference/the_excerpt

    Best regards,
    Striking Team
    Paul