Posted: October 10, 2016 at 2:03 pm
Running into some strange behavior. Is it possible with a reset or something to do multiple shortcode lists on one page? For example: (in the WYSIWYG) Category blue Events: Category Red Events My hope is to do a jquery tabbed content with event lists (different cateogries) on each content div. |
|
Hi Peyton, You didn’t mention what the strange behavior was. I can let you know that using quotes in shortcodes can lead to strange behavior, so it’s best to do this instead:
|
|
The strange behavior is that once the first shortcode is pasted, another shortcode with a different category_slug still pulls the first category slug. You can see this here: There are clickable tabs on that page in the green box. Each represents a category. Each has a shortcode at the end of the content that is the same category_slug as the tab. But as you cycle through, they are all the event lists from the katany category (the first one) – They won’t “reset” to the right category each time a new shortcode with a different category_slug is shown. |
|
Hi Peyton, So I can understand what’s happening there, are the shortcodes being placed within the main content editor of the post or are those shortcodes in some kind of page builder or other non-native to WordPress content editor box? The reason I ask is because the shortcodes tend to not work correctly if they’re not placed in the main content editor. |
|
They are in Advanced Custom Fields Is there any way to get them to show without the_content() ? If I put them in the_content, the ACF fields display correctly. It seems very limiting to have to use the_content(); How can I avoid listing them all in the_content(); surrounded by display: none; just to get my lists to show below? |
|
That’s going to be tricky because the post short code tracking only checks the post content, it doesn’t loop through all the shortcodes and check through the post meta. You make a good point that it should, or at least there should be a way to optionally add that for the use case where someone wants to use shortcodes outside of the_content. |
|
I opened up a discussion with the dev team so they’re aware that there’s a need to not limit the post short code tracking to the main content section only. In the meantime, you can avoid listing the events in the_content by placing the following in there:
So it’s an html comment, and the double brackets will prevent the short code from being parsed. |
|
The support post ‘multiple event list (shortcodes) on one page’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.