It sounds like you’re on the right track with adding the add_filter lines to your code. However, there could be a few reasons why the registration button shortcode is not appearing in the excerpt.
First, make sure that the shortcode itself is correct and that it works when used outside of the excerpt. You could try adding it to a page or post to test it out.
If the shortcode is correct and works in other areas of your site, then it’s possible that there is a conflict with another plugin or theme. Try disabling other plugins and switching to a default WordPress theme to see if that resolves the issue.
If neither of those solutions work, you could try modifying the excerpt_more filter to add the registration button after the excerpt. Here’s an example of how you could do that:
function add_registration_button_to_excerpt( $excerpt ) {
global $post;
if ( is_singular( 'event' ) ) { // replace 'event' with the post type of your event
$registration_form = do_shortcode( '[registration-form event=' . $post->ID . ']' );
$excerpt .= '<br><br>' . $registration_form;
}
return $excerpt;
}
add_filter( 'excerpt_more', 'add_registration_button_to_excerpt' );
This code checks if the current page is a singular event page and if so, it adds the registration button shortcode after the excerpt. You can customize this code to fit your specific needs.
I hope this helps! Let me know if you have any other questions.
Thread Starter
csbebe
(@csbebe)
Hi Linards,
Thanks for your detailed answer, I appreciate it.
- The shortcode is working in other post/page.
- I staged my current site and removed my theme and switched off every plugin I have. I only left the Event Calendar, Event Register and the Code Snippet plugins.
- I tried your code too and still nothing.
So I’ve tried everything above but unfortunately It did not help. Maybe I should just let this button go.. 🙁
Best Regards,
Bence
I’m sorry to hear that none of the previous solutions worked for you. Before giving up on the button, there are a few more things you could try:
- Check if the excerpt is actually being used on the event page. Some themes or plugins may use a custom excerpt or summary instead, which could explain why the shortcode isn’t working. You could try adding the registration button shortcode directly into the template file for the event page to see if it appears.
- Try using a different shortcode plugin. It’s possible that the plugin you’re using to generate the registration button shortcode is not compatible with the filters or other plugins you have installed. You could try using a different shortcode plugin to see if that makes a difference.
- Contact the plugin developer for Event Register. If the registration button shortcode is specific to this plugin, there may be a conflict or issue that the developer can help you resolve.
Thread Starter
csbebe
(@csbebe)
Hi Linards,
Thanks for the last tip. I contacted the support of Event Register and a developer could help me. It was a tricky excerpt!
Thanks for your help!
Regards,
csbebe