Is there a way to define a custom attribute, and then have that value inserted into a looper query string?
e.g.
data-page = “Food”
post_type=data-page
I tried but the value isn’t replaced.
Is there a way to define a custom attribute, and then have that value inserted into a looper query string?
e.g.
data-page = “Food”
post_type=data-page
I tried but the value isn’t replaced.
Hello @bill_hodgson,
Custom Attributes can be accessed by javascript. You cannot use it alongside the Looper Provider Query String.
Best Regards.
Can you think of any way to hold a value on a page which can be passed into a query string? It would mean a simpler way to use the same query on multiple pages and just change the input value.
Hello @bill_hodgson,
You can make use of the URL parameters and then use the parameters in your Looper Provider Query String. For example, https://example.com/my-page-name?cat="travel" and then in your Looper Provider Query String, you can have post_type="post"&category_name={{dc:url:param key="cat" fallback=""}} .
By the way, can you please give further explanation of what you are trying to do? You can include a screenshot or mock layouts or sample URL so that we will have a deeper understanding of your idea.
Cheers.
Hello Rue,
As an example I made this site, on which I display many documents from a CPT, but with different criteria for each page. https://dev2porlock.com/full-council-agenda-and-minutes/
What I did was build a component with the entire loop provider and then consumer display, and made a text parameter into which I can type the query parameter. I also added a parameter for the number of posts to be returned and insert that into the query string.
Now I insert the component onto the page, edit the parameters and bingo I’ve got what I needed.
Best wishes, Bill
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.