Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    Hi, does this also happen when you disable all other plugins, and with a default WP theme?

    This happened a long time ago with another user, but never really figured out what triggered it.

    Where are you hosted?

    Thread Starter Andy Macaulay-Brook

    (@andymacb)

    Hi, thanks.

    Self-hosted using cPanel, installed WP myself, theme hand built from scratch. No framework or pagebuilders or anything like that but a careful selection of plugins.

    My first assumption was that you have a filter on the_content but I commented out the_content in the template and that didn’t fix it.

    I’ll go through the usual fault finding process as you suggest and report back.

    Plugin Author Tijmen Smit

    (@tijmensmit)

    You tried to comment out line 59 in the class-frontend.php, or in the custom template itself?

    Can you try to comment it out in the front-end class?

    Thread Starter Andy Macaulay-Brook

    (@andymacb)

    I tried in my theme template. Thanks for the pointer, I’ll try that too.

    Thread Starter Andy Macaulay-Brook

    (@andymacb)

    Here’s what I’ve found so far.

    I have a second laptop copy of the site, though possibly with some differences that I’ll need to work out. On the face of it the plugins and options are all the same. This site copy does not have the problem. I’ve flushed permalinks & cleared transients on both sites.

    If my store locator page template uses get_template_part() to include the file with the page loop, I get this duplicate info issue on the problem copy of the site.

    If I paste the loop code into the the page template, so the only difference is that I am not using get_template_part() then the duplicate store map & info go away.

    Either way, I can’t at the moment replicate the problem on my laptop copy, which is odd.

    I’ll update more when I’ve studied it more.

    Thread Starter Andy Macaulay-Brook

    (@andymacb)

    So, bizarre.

    Same plugins, same theme, same WPSL settings. Can’t reproduce problem on my local copy of the site.

    But, if I rename my included theme file the problem goes away.

    So I had single-wpsl_stores.php calling the file containing the loop:

    get_template_part( 'main', 'single-dealer' );

    and got 2 maps & 2 dealer details: One from my do_shortcode calls in main-single-dealer.php and one by magic.

    Change main-single-dealer.php to dealerstuff.php and the problem goes away.

    I’m going to see how it goes today and then I’ll return to close the ticket with any extra info I have.

    Thread Starter Andy Macaulay-Brook

    (@andymacb)

    OK – there must be some kind of caching at play here that’s confused me.

    When I add a call to the_content() into the template I now get the duplication back and I now also see it on my laptop copy. So – reproducible.

    If I dump all the functions attached to filter the_content immediately after calling the function, I see that there is an entry:

    [000000001fb141ca0000000128f82cc7cpt_template] => Array

    This corresponds to your response earlier of course, line 59 of class-frontend.php.

    So – after a confusing runaround, if I comment out line 59 then yes the problem goes away.

    Maybe nobody else tries to make a custom template, because it looks like this would always happen if you follow the plugin documentation. Or am I reading the source code wrong?

    I’m still on WPSL 2.2.9. Would 2.2.11 have anything in to help solve this? I haven’t upgraded because I made a small JavaScript source code change to catch a click on the location autocomplete dropdown to trigger the search.

    Plugin Author Tijmen Smit

    (@tijmensmit)

    I now remember someone telling me about get_template_part() and the duplicate content a while ago.

    Lots of people make custom templates ( I get quite a few questions about it through the support ticket system every week ), and this is maybe the third time in 3 years or so this a problem.

    I also remember that I never managed to replicate it, which is the main reason it’s still an issue now.

    I just used get_template in a custom template and I don’t get duplicate content, so what’s exactly in the main-single-dealer.php file?

    Can you create a gist on Github with the content of main-single-dealer.php, or if you want / can email it then let me know and I will share that.

    Are you using Apache or something else?

    Thread Starter Andy Macaulay-Brook

    (@andymacb)

    It isn’t get_template_part. I’ve just retested now I can reproduce on my laptop and the only consistent thing that causes the duplication is the use of the_content().

    What I want to achieve is a page that shows the map shortcode then the visual editor content then the address shortcode and some additional meta fields.

    So I get one map from my shortcode, map and address from the WPSL filter on the_content and then address from my shortcode.

    Gist of the template at https://gist.github.com/andymb/43895b06a68d090bcbce54c48bf3f1e2

    I’m on Apache, CentOS on main web server, MacOS on laptop. Been hosting WP sites for 7 years so I’m pretty sure it’s not server related.

    Thread Starter Andy Macaulay-Brook

    (@andymacb)

    I’m an idiot.

    If you compare my Gist to your documentation you’ll see that in my template I’m running a loop, and in your example you’re not.

    If I remove my loop then everything works fine.

    I can see that you test for in_the_loop when automatically adding the map & address, so using my own loop made this test pass.

    Thread Starter Andy Macaulay-Brook

    (@andymacb)

    So, a developer feature request: Can line 59 in class-frontend.php have a true/false filter?

    Thanks.

    Plugin Author Tijmen Smit

    (@tijmensmit)

    So, a developer feature request: Can line 59 in class-frontend.php have a true/false filter?

    Yes, I will add something that makes it easy to enable / disable in the next update.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Custom Store Page Template showing two maps & two sets of info’ is closed to new replies.