[Resolved] Display short code in Post Grid?

Home Forums Support [Resolved] Display short code in Post Grid?

Home Forums Support Display short code in Post Grid?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #408967
    jrides

    Hi,

    Is there a way to display short code in the post grid? Maybe an additional meta field is possivle to achieve this? Looking for something that will hopefully display in most Show Post style plugs. Trying to show an Elementor template below each post. Could be useful for displaying ratins, or an audio player etc as well.

    Complete novice to WordPress, with no coding skills. But willing to roll my sleeves up a bit to try and get this figured out.

    Using the latest WP, GP Premium and Elementor builds and tinkering with a few show post plugs. Any assistance provided is greatly appreciated.

    #409184
    Leo
    Staff
    Customer Support

    Hi there,

    I’m not sure what you mean. Can you provide an example of what you are trying to achieve?

    Thanks!

    #409330
    jrides

    You know how there are many programs that will allow you to create something and display it via short code? I can insert the short code in a hook, or the body of a post etc and it will display it? I just want to do the same thing but with the individual posts in a post grid, masonry display, etc.

    I can use a plugin like WP Show Posts to display the grid by lets say taxonomy. Instead of the excerpt, or below it, I want to display an item via short code.

    Display Below Posts on Grid

    From what I can tell, a custom field with the short code as the meta data, might be in the neighborhood of a solution, but not sure how to go about it. I do understand that this is something that will need to be created for each new post, probably.

    #409616
    Tom
    Lead Developer
    Lead Developer

    You could just hook your shortcode into a hook like this: https://docs.generatepress.com/article/generate_after_entry_content/

    Doing it that way should work fine.

    Let me know if you run into any issues, or need help with the code πŸ™‚

    #413132
    jrides

    Thanks for your reply! I tinkered around with your suggestion and found that it only added the shortcode results after the blog content within the post.

    I did find a solution though. My excerpt was being automatically generated. Going to page options and ticking the excerpt field to display option, allowed me to enter the shortcode there. In most of the post gird plugins the results displayed perfectly. Now I can display things there using the grid in WP Show Posts or Elementor Pro.

    However the shortcode displays as text when generate blog excerpt is selected. The ccategory and archive results do not display the excerpt the same way a plugin like WP Show Posts does.Is there a way to fix this?

    #413233
    jrides

    Here is a visual example. On the pages I can use elementor to display posts like below.
    Code displayed as result

    In GP Premium the excerpt displays as text in categories, archives and search results. Shown below.
    Displayed as text

    Both are pulling from the excerpt field in GP. Any thoughts? Perhaps I can hide the excerpt somehow , if there is no way to get the shortcode to display correctly, for these pages? Generate blog does not appear to have a setting for this.

    #413415
    Tom
    Lead Developer
    Lead Developer

    You could try telling WordPress to execute shortcodes in excerpts using this line of PHP:

    add_filter( 'the_excerpt', 'do_shortcode');

    Let me know πŸ™‚

    #413839
    jrides

    THANK YOU SIR!

    This worked perfectly. I also found a plugin called Easy Custom Auto Excerpt which fixed the issue. However,I think the code snippets one may prove to be more useful, over the long term.

    This issue is resolved. I appreciate the assistance.

    #414002
    Tom
    Lead Developer
    Lead Developer

    Glad I could help πŸ™‚

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.