- This topic has 12 replies, 3 voices, and was last updated 3 years ago by
Tom.
-
AuthorPosts
-
January 18, 2020 at 2:06 pm #1136390
Travis
Hello –
I’m trying to use shortcodes in a post, but it isn’t working – just to confirm that it wasn’t a specific plugin, I created the following in functions.php
function test_shortcodes()
{
return ‘Shortcodes are working!’;
}
add_shortcode(‘test_shortcodes’, ‘test_shortcodes’);and entered:
[test_shortcodes]None of it seems to be working – any thoughts?
January 18, 2020 at 5:31 pm #1136459Leo
StaffCustomer SupportHi there,
Maybe something like this would help?
https://generatepress.com/forums/topic/inside-hero-hook/#post-928922This shouldn’t be theme related 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/January 18, 2020 at 5:36 pm #1136461Travis
I’m not trying to create hero oages, I’m trying to use baseline WP shortcode functionality. Switching the theme means shortcodes work. Switching back doesn’t.
Is there anyone else available to look at this issue that is willing to try to assist?
January 18, 2020 at 5:43 pm #1136463Leo
StaffCustomer SupportDoes the same shortcode work in a default twenty series themes?
If you search
ob_start
in our forum, you can see lots of examples of creating shortcodes:
https://generatepress.com/forums/search/ob_start/Does that help?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/January 18, 2020 at 5:48 pm #1136465Travis
Yes, as stated clearly above:
>I’m trying to use shortcodes in a post, but it isn’t working – just to confirm that it wasn’t a >specific plugin, I created the following in functions.php
and then stated in my follow up post to your first dismissal:
>I’m not trying to create hero oages, I’m trying to use baseline WP shortcode functionality. Switching the theme means shortcodes work. Switching back doesn’t.
*Please* get someone else to respond to this – the last time I had an issue with this theme and tried contacting support, I was similarly frustrated with your response. I need someone to actually provide the support that was supposed to be included with paying for this theme.
January 18, 2020 at 5:51 pm #1136467Leo
StaffCustomer SupportLooks like I was able to resolve your last two topics and one was due to your custom CSS error.
I’ll get Tom to respond to this one.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/January 18, 2020 at 5:54 pm #1136470Travis
I also submitted a complaint to Generate Press about the frustration I had with your communication, which apparently was directed to and responded to by you. I look forward to hearing from Tom.
January 18, 2020 at 6:29 pm #1136483Tom
Lead DeveloperLead DeveloperHi Travis,
Sorry for any frustration here.
GeneratePress itself doesn’t alter the standard WordPress shortcode functionality, so there must be something else in play.
Do you have any other custom functions added to the theme (maybe the child theme)? Maybe one of those is preventing shortcodes from working?
Your shortcode function itself looks good.
Are you adding the shortcode inside your content? If so, are you using a Shortcode block in the editor?
How are you adding the function? In a child theme?
Let me know – we’ll figure it out 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJanuary 18, 2020 at 6:33 pm #1136484Travis
Hi Tom,
Thanks for your prompt attention. The shortcode is being added to a post, but I’ve been experiencing the same issues when adding to the body of pages as well. I have a couple of custom functions, but have primarily been using the elements functionality since it’s a lot easier and less prone to site-breaking… none of them seemed to be causing an issue otherwise.
I think one of the things that’s vexing is that shortcodes worked at one point and then… didn’t – that test function worked on the 20xx theme previews, so I was able to confirm it wasn’t the plugin that created shortcodes.
It’s definitely a weird issue…
January 18, 2020 at 6:34 pm #1136486Travis
Ah, and I haven’t been using a shortcode block in the editor – just adding it into the text input using the Classic editor, if that’s of any help.
January 18, 2020 at 6:35 pm #1136487Tom
Lead DeveloperLead DeveloperDoes it work if you use the Shortcode block?
Can you temporarily disable your other custom functions just to see if there’s a conflict somewhere? Shortcodes should 100% work using GP (we use a bunch of them here on this site), so we just need to find the conflict on your site.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJanuary 18, 2020 at 9:15 pm #1136536Travis
Thanks Tom – disabling the other custom functions seemed to restore the functionality… I’ll go through and re-enable them one by one to see where the issue is.
I haven’t actually updated any of the functions since well before the issue arose, which is confusing… hopefully that’s all there is to it?
January 19, 2020 at 9:14 am #1137026Tom
Lead DeveloperLead DeveloperI assume one of them is filtering shortcodes (maybe). Feel free to share the problem function and I’ll try to spot the issue.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.