Jump to content
Sign in to follow this  
hazlebury

Enable shortcodes in Excerpts

Recommended Posts

hazlebury

Please could you advise how I might be able to get shortcodes working in the Excerpts (e.g. my [add_to_cart] shortcode). I've googled this and there do seem to be some amendments to the functions.php but I don't want to muck about with programming if I can help it.

Share this post


Link to post
Share on other sites
kastelic

Make sure you are in HTML mode when adding shortcodes. Other than thad you'd have to tell us a little more about your specifics.

Share this post


Link to post
Share on other sites
hazlebury

To get the "add to cart" button, Cart66 requires placement of a short code in the post content (each product is a post). However, when I view the category page with the abbreviated content, the short code gets stripped out by the theme, even if I put it at the beginning of the content area of the post.

Share this post


Link to post
Share on other sites
kastelic

Have you tried putting your shortcode and whatever you want as the excerpt into the excerpt box (below the post content) of your post/item?

Share this post


Link to post
Share on other sites
hazlebury

Yes, short codes get stripped from excerpts

Share this post


Link to post
Share on other sites
catrina

The excerpts aren't particularly code-friendly. Have you searched for a plugin that might allow the excerpt to take code?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
Kate

Hi Patrick - There's a couple other options. First, you could choose to show the full content for your blog area, instead of just excerpts. Then manually insert the

<!-- more -->

tag wherever you want the post to cut off. Second: using manual excerpts (the box that appears below your main post edit screen) should allow you to add the shortcode... But I can't remember 100%. I'd have to check. Finally, another option is to use the "Advanced Excerpt" plugin. Then, in your template.postloop.php (preferably a copy in your child theme) you could write an if statement that basically says: if advanced excerpt plugin exists, use that. If not, use the default wordpress excerpt. Now, maybe you'd consider that "mucking around in the code"... but it would be pretty straightforward ;) Let us know if you need help implementing any of those, or the option you found with functions.php.

Share this post


Link to post
Share on other sites
hazlebury

Hi, the first solution doesn't work because the More tag strips the shortcode - possibly in the same way that Platform Pro also does when it lists out the posts with "continue reading". The second doesn't work because shortcodes can't be put in Excerpts. The third doesn't work because Advanced Excerpt generates a javascript error.

Share this post


Link to post
Share on other sites
bryan-hadaway

Patrick, the first one is what I would also have recommended, I see no reason why it wouldn't work unless the shortcode simply wasn't working in the first place no matter what the circumstance. Can you please try the first solution again and post a link so I can see what's happening myself? Thanks, Bryan

Share this post


Link to post
Share on other sites
Kate

Hi Patrick: Did you make sure you set the post pages to display the full content?

Share this post


Link to post
Share on other sites
hazlebury

Hi, I gave up with Cart66 (ex PHPurchase) and have gone with a Paypal solution that works fine. Phew.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×