Skip Navigation

[Resolved] my view is duplicating over and over

This support ticket is created 4 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Shane 4 years, 3 months ago.

Assisted by: Shane.

Author
Posts
#1733665
Screen Shot 2020-08-10 at 5.46.40 PM.png

Tell us what you are trying to do?
create a view to display custom fields on single posts.
I created a view ( 2 different ones) to display on single posts.
they are showing but its duplicating over and over and over.

the view needs to show:
1) redirect link
2) download link

this is my code:

[types field='resource-download-link' item='$current_page'][/types]<br>
[types field='redirect-link' item='$current_page'][/types]

see the image for whats happening.

i want to say its repeating for every post I have with this post type. when it should only display the info for the post that its on.

#1734731

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jen,

You actually don't need to create a view to add the custom field data to the page. You can actually do it by adding the shortcodes directly to the page template itself.

If you are using a content template for this page then you can simply just add the shortcodes directly to the content template. What I mean is that the same place that you've added the view shortcode you can just add the fields shortcode directly to the template.

The reason why this is occurring is because you view is looping through all the posts.

Thanks,
Shane

#1736189

I have to use a view because I have conditional statements. and with the elementor widgets for toolset i cant put conditional statements in.

#1737707

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2020-08-13 at 10.44.56 AM.png
Screenshot 2020-08-13 at 10.44.44 AM.png

Hi Jen,

In this cause you can just add a query filter to your view for the Post ID. See Screenshots

You will then set the view to get the ID by a shortcode parameter. See Screenshot.

Finally just call your view like this.


[wpv-view name="my view" ids="[wpv-post-id]"]

This will allow your view to filter based on the current page that it is on.

Thanks,
Shane