- This topic has 8 replies, 3 voices, and was last updated 3 years, 6 months ago by Tom.
October 24, 2017 at 2:54 am #408967jrides
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.October 24, 2017 at 8:04 am #409184LeoStaffCustomer SupportOctober 24, 2017 at 10:43 am #409330jrides
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.
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.October 24, 2017 at 11:01 pm #409616TomLead DeveloperLead 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 🙂October 30, 2017 at 10:48 am #413132jrides
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?October 30, 2017 at 1:41 pm #413233jrides
Here is a visual example. On the pages I can use elementor to display posts like below.
In GP Premium the excerpt displays as text in categories, archives and search results. Shown below.
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.October 30, 2017 at 10:35 pm #413415TomLead DeveloperLead 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 🙂October 31, 2017 at 12:41 pm #413839jrides
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.October 31, 2017 at 8:55 pm #414002
- You must be logged in to reply to this topic.