Skip Navigation

[Resolved] Inserting Ads into View Loop

This support ticket is created 6 years, 10 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 reply, has 2 voices.

Last updated by Beda 6 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#541612

Hi,

I have a basic situation, but running into a brick wall on it:

I have a VIEWS loop, listing all posts in chronological order (Basic thumbnail, title, excerpt) for user to then click on and see full posts. (A basic blog roll).

Every X number of posts on this list, I'd like to insert an advertisement. So my programming is:

<wpv-loop wrap="5" pad="true">  
 
[wpv-item index=3]
  CALL ANOTHER VIEW TO INSERT AD
  MAIN CONTENT

[wpv-item index=other]
 MAIN CONTENT 

</wpv-loop>

So the above works, BUT, I need the 2nd VIEW to show ads by descending by date. The problem is every time this code calls up VIEW#2 it start it from the top (first) post. I need a way to increment it each time it's called.

Makes sense?

I feel that views might have a simple solution for this, other than having to create some form of php counter. If that is the only option though, I'd wondering if you could get me going on it.

#541796

If you have a view, that presents any results without any query, it will just do that:
Present the results, as many times you insert it to a page or view or content Template.

There is no way to "count" thru them.

So, if you insert that View once, and tell the code to repeat it every third item, it will do exactly that.
It will display ALL results every third item.

Unfortunately there is no solution with Views for your issue.

The only what you could do is to display one result only, and order randomly.
That would produce a different result in each of the index-items.
But that is not what you want, as far I understand.

It seems -unfortunately- that for now you need custom programming work which is beyond the scope of our support.

At this point I would suggest you consider contacting one of our certified partners from this link:
https://toolset.com/consultant/

You will get the custom assistance you need to get on with your project.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.