Support

Home Forums Event Espresso Premium Shortcode results in duplicate content when used multiple times on same page (2)

Shortcode results in duplicate content when used multiple times on same page (2)

Posted: June 8, 2015 at 4:21 am

Viewing 5 reply threads


Remco Siero

June 8, 2015 at 4:21 am

I’ve found this topcis here & here but i’m still having troubles with duplicate content. Strange enough: It’s working great on my development server but having the same installation on my production server i get duplicate content.

Im using EE4

Production:

WordPress Versie:
4.1
PHP Versie:
5.3.27
MySQL Versie:
5.5.31
Event Espresso Version:
4.6.14.p

Development

WordPress Versie:
4.1
PHP Versie:
5.3.21
MySQL Versie:
5.1.49
Event Espresso Version:
4.6.14.p


Dean

June 8, 2015 at 5:19 am

Hi,

This should have been resolved in 4.4.9 and as far as I can tell from my test site it is working as intended.

Can you provide the shortcodes you are using on the production site please?


Remco Siero

June 8, 2015 at 5:23 am

I’m using it for an year calendar:
[ESPRESSO_EVENTS month=”june 2015″ title=” ” css_class=”jaaroverzicht_events”]

http://www.cooperatieacademie.nl/jaaroverzicht/

But i’m placing this through a do_shortcode

<?php echo do_shortcode(‘[ESPRESSO_EVENTS month=”‘.$month_uk.’ ‘.$year.'” title=” ” css_class=”jaaroverzicht_events”]’); ?>


Dean

June 8, 2015 at 6:42 am

Hi,

I tried these shortcodes and they worked:

[ESPRESSO_EVENTS month=”June 2015″ title=”” css_class=”jaaroverzicht_events” limit=”3″]
[ESPRESSO_EVENTS month=”july 2015″ title=”” css_class=”jaaroverzicht_events” limit=”3″]

However, I tested it via do shortcode (I used just the words for the dates, rather than variables) and it did exactly what is happening to you.

I spoke to a developer about this, and basically the ESPRESSO_EVENTS isn’t designed to be used via do_shortcode() in this sort of situation. The shortcode uses lazy load code to only load parameters for posts/pages it was saved to. In effect this speeds up the load time, but it disables parameters when using do_shortcode().

He recommends using the WP Loop or a custom loop (query) to grab the data instead.

You could use Josh’s example query (https://gist.github.com/joshfeck/e3c9540cd4ccc734e755) as a base for your own query.

For example I made this (very bad and very basic) example here: http://pastebin.com/T8qS5Jg6

All it does is loop through an array of dates and run a query and output the title and link. It’s far from perfect and is really not optimized.

Personally I would look to get all the dates between the set period and then filter and output them after you have them in an array as this will be faster, as my example simply makes a new database query for every single month.


Remco Siero

June 8, 2015 at 6:47 am

Thnx for you great reply, i will dive into it. One thing what is strange about is: It does work on my development server with do_shortcode. Is there an explanation why it could work on my development server but not on my production server ?


Dean

June 8, 2015 at 6:52 am

Hi,

You’re welcome!

Honestly, no idea! It didn’t work on my dev server (local) and in theory it shouldn’t work on any. The developer who created it might have a better answer to that question, but I think you will still need to go down the query route (plus it will end up being more flexible for you).

Viewing 5 reply threads

The support post ‘Shortcode results in duplicate content when used multiple times on same page (2)’ 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.

Event Espresso