Skip Navigation

[Resolved] Duplicate Content Displayed in View with AJAX

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a View that shows one result at a time, paginated with AJAX, and sorted by post date. When I use pagination, I often see results repeated.

Solution: This seems to be caused only when the current User is logged into WordPress.

This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by Laura Savard 6 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1078586

Hi Christian,

Hope all is well. We finally launched our website yesterday!!!

I've got a two-part question based on one specific View we've created with Toolset:

On the Brand Facts page of our website ( hidden link ) we are using a Toolset View to display an AJAX list of 336 brand facts. We have the View set to "order" by Post Date - Descending. (attached screen grab of settings)

1. The view seems to be generating duplicate content. When you click through the "next button", you end up coming across the same facts multiple times, when in fact each fact only exists once in the database.

2. The Social Icons (created through Add To Any plugin) show up twice on the initial page load (the top set shares the individual fact, and the bottom set shares the Brand Fact page itself. When you click the "next button," both sets of sharing icons disappear. I am trying to keep it so that only one set of icons appears under each fact and it the individual fact, not the overarching Brand Terms page. (attached screen grabs)

Cheers,
Laura

#1078619

Hi, sorry I didn't receive the attachments.
1. The view seems to be generating duplicate content. When you click through the "next button", you end up coming across the same facts multiple times, when in fact each fact only exists once in the database.
Can you tell me more about this?
- Is it consistent? Are the same items duplicated each time you check, or is it not predictable?
- Are you using a specific browser or device?
- Anything else you can tell me about how to replicate this? I flipped through about 100 and didn't see any duplicates that I'm aware of. Are you flipping very quickly, or very slowly, or flipping back and forth somehow?

2. When you click the "next button," both sets of sharing icons disappear.
This sounds like a problem where a social sharing plugin initializes its sharing icons when the page first loads, but then does not reinitialize them when new content is loaded with AJAX. There may or may not be a way to get around this with your particular sharing plugin, it depends on how it's set up. If you can disable the default placement of the icons and use a shortcode to display them instead, you may have better luck showing them on each individual fact page by inserting the shortcode in a Content Template. Otherwise, the plugin will try to insert them any time the_content() is called, which can be multiple times on a page when using Views and Content Templates.

Your plugin may also offer a JavaScript method to initialize any new sharing icons that are placed using AJAX. That's something their support team would have to assist with. I can show you how to call any JavaScript code when pagination has been triggered, but I need to know what JavaScript code should be called.

#1078721
Toolset-view1.png
Screen Shot 2018-08-09 at 10.05.38 AM.png
Screen Shot 2018-08-09 at 10.04.54 AM.png

On issue 1, my feedback is below (also posting the screen grabs again.)
On issue 2, I will take a look into this more tomorrow and reply.

In my latest test, I was using FireFox on a Mac and scrolling through slowly, with enough time for me to copy and paste the contents of each quote below.

_______________________________________________
TEST 1 - FireFox Mac
Out of 17 facts, it is duplicating the following:
2 and 9
7 and 11
3 and 8 and 13
15 and 17
_______________________________________________

1. Phil Knight didn’t love the name “Nike” nor the “swoosh” but needed a name and logo quickly as shoes entered production.

2. Wawa pioneered the check-out counter by being perhaps the first to separate the cashier and the deli. It was also one of the first convenience stores to implement a touch screen ordering system.

3. “Wawa” is the Lenni-Lenape name for “Canada goose”.

4. WD-40 was originally developed for the US space program and the name stands for Water Displacement formula 40.

5. Whole Foods selects new store locations based on the number of college graduates within a 16-minute drive.

6. The first product to have a bar code was Wrigley’s gum.

7. In 2000, the WWF (World Wrestling Federation Entertainment Inc) was sued in the UK by the WWF (World Wide Fund for Nature). The former was forced to change their name to WWE.

8. “Wawa” is the Lenni-Lenape name for “Canada goose”.

9. Wawa pioneered the check-out counter by being perhaps the first to separate the cashier and the deli. It was also one of the first convenience stores to implement a touch screen ordering system.

10. The three tuning forks of the Yamaha logo mark represent Technology, Production, and Sales as well as the three essential musical elements: Melody, Harmony, and Rhythm.

11. In 2000, the WWF (World Wrestling Federation Entertainment Inc) was sued in the UK by the WWF (World Wide Fund for Nature). The former was forced to change their name to WWE.

12. Zipper was originally a trademark of B.F. Goodrich for use in rubber boots.

13. “Wawa” is the Lenni-Lenape name for “Canada goose”.

14. Volkswagen owns Audi, Bentley, Bugatti, Lamborghini, Porsche, SEAT, Skoda, Ducati, MAN and Scania.

15. Volvo’s “safety” position is based on the fact that they invented the three-point seatbelt and gave the patent away to save lives.

16. For the past 30 years or so, the ubiquitous, yellow-roofed chain restaurant, Waffle House, has also been working on a side project: its own record label, named Waffle Records, of course.

17. Volvo’s “safety” position is based on the fact that they invented the three-point seatbelt and gave the patent away to save lives.

_______________________________________________
TEST 2 - Google Chrome Mac
Out of 17 facts, it is NOT duplicating anything and the “order” of the facts is different, which makes no sense to me.
_______________________________________________

1. Phil Knight didn’t love the name “Nike” nor the “swoosh” but needed a name and logo quickly as shoes entered production.

2. Zipper was originally a trademark of B.F. Goodrich for use in rubber boots.

3. YouTube began as a video dating site named Tune In Hook Up.

4. Yelp began as an automated system for emailing recommendation requests to friends.

5. The logo on Yamaha motorcycles is made up of three tuning forks because the company started out making musical instruments.

6. The three tuning forks of the Yamaha logo mark represent Technology, Production, and Sales as well as the three essential musical elements: Melody, Harmony, and Rhythm.

7. Yahoo, is an acronym for “Yet Another Hierarchical Officious Oracle.” However, the word “yahoo” was coined by Jonathan Swift to describe a rude, noisy and violent character is Gulliver’s Travels.

8. Yahoo was originally named “Jerry’s Guide to the World Wide Web.”

9. In 2000, the WWF (World Wrestling Federation Entertainment Inc) was sued in the UK by the WWF (World Wide Fund for Nature). The former was forced to change their name to WWE.

10. The first product to have a bar code was Wrigley’s gum.

11. Whole Foods selects new store locations based on the number of college graduates within a 16-minute drive.

12. Dave Thomas named Wendy’s after his daughter. However, her name isn’t Wendy. It’s Melinda. Wendy is her nickname.

13. WD-40 was originally developed for the US space program and the name stands for Water Displacement formula 40.

14. “Wawa” is the Lenni-Lenape name for “Canada goose”.

15. Wawa pioneered the check-out counter by being perhaps the first to separate the cashier and the deli. It was also one of the first convenience stores to implement a touch screen ordering system.

16. The first Wawa store opened in Folsom, PA in 1964.

17. Wawa started as a dairy farm in the DelCo town of Wawa, PA in 1902.

#1078789

Okay thanks, I'm not able to replicate this on a Mac with Firefox 61.0.2, either, so there must be something else going on.
- Clear cache and cookies and test again.
- Is the behavior different depending on whether or not you are logged in to WordPress?
- Is it possible there is an addon, extension or plugin causing a problem in the browser? Temporarily deactivate any addons you have in Firefox.
- Uncheck the "Don't include the current page in query results" checkbox in the View editor screen. I've seen this cause unexpected issues when it's not necessary.

#1083219

Thanks Christian! Sorry, I've gone dark for a few days.

In regards to issue #1 - duplicate brand quotes showing. It turns out that it only happens when I'm logged in to WordPress, so that's why it was happening in Firefox - where I was logged in and not in Chrome - where I was not logged in. So, that's resolved!!

issue #2 - I need to look into that one later this week. Thanks for the direction. Sounds like it's not a toolset issue, so I'll see if I can resolve it through the Add to Any Plugin.