Looper | URL Passback | Slug Targeting Problem

Heya! I’m following this documentation you’ve made, plus an older post I made, that generally explains the URL passback + looper arrangement well.

I’m trying to have a button inject a post slug, as in ?course=post_slug , however I’m unclear as to how to pull that into a provider. I thought that the post_name WordPress variable would work…

(e.g. post_name={{dc:query:query_var key="course"}} as a Looper Provider | Query String )

…however I’m finding that it doesn’t work as expected. Or rather, at all. :stuck_out_tongue: What’s my error here?
.
.
.
.
Note that I had the same results when I tried to test using a {{dc:post:id}} paired with post_id={{dc:query:query_var key="course="}} in the looper provider (and variations such as id=, post=, etc)


While I’m at it… is the only way to pull a slug in really just a meta>wp_old_slug setting? I would have sworn that at one point in the past there was an actual ‘slug’ setting for dynamic content. If there’s a better way, please enlighten me!

Hello @Rule72,

Thanks for writing in!

You are using the incorrect query string parameters. Please refer to this codex instead:

Best Regards.

Oh snap. I’d tried those and they hadn’t work, but testing just now I realized there was no consumer set. :stuck_out_tongue:

Setting a consumer appears to have fixed my problem.

Hi @Rule72,

Glad to know that problem is fixed now.

Thanks

It’s fixed via p={{dc:url:param key="course" fallback="course"}} and using a {{dc:post:id}} element, but I do want the slug to power this instead.

?course={{dc:post:meta key="_wp_old_slug"}} paired with
name={{dc:url:param key="course" fallback="course"}} doesn’t appear to work, is this the wrong element?

Additionally, when using a URL parameter such as this… does it mean that the Condition for “Looper Provider is empty/not empty” is off the table in terms of design? I’m not seeming to be able to get items to display when there’s a set value and disappear when there’s not by using that condition.

Hi @Rule72,

Two expressions are completely different, the first one worked for you getting the value from the URL using the Dynamic Content i.e. {{dc:url:param key=“course” fallback=“course”}}. Whereas the next expression is getting the value from Meta field using the {{dc:post:meta key="_wp_old_slug"}} which is paired with the name field. It is not very clear what exactly the course and the name fields are in your second expressions? But the p is in the first expression is referring to the Post ID which is compared with the value that comes through the URL.

It is also not clear what exactly you are trying to know about the condition for the URL parameter. I would request you explain a bit more.

Thanks

EXPRESSIONS, thanks – that’s a term that I’ve been looking for. :stuck_out_tongue: For clarity, the ID-based expression was a proof-of-concept, but I want the URL to be more easily readable for both management and some marketing purposes. So an expression using a post slug is the more ideal route.

Anyway…

I have buttons set to output a ?course=slug URL passback, which appears to need to use the _wp_old_slug key (via meta) if I want this to be dynamic. I then want to have a looper provider take that slug as input… I suppose you’re saying _wp_old_slug in the passback element is not usable in the name= expression for the provider, is that correct?

Hello @Rule72,

Your button will have a link of: {{dc:post:meta key="_wp_old_slug"}}

Your Looper Provider Query String needs to be post_type="post"&name={{dc:url:param key="course" fallback="course"}}

You have have to include the post type so that the Looper can easily find the page or post that bears that slug that you want. Now, if the Looper Provider does not return anything, then it could be because that the parameter dynamic content did not return anything.

It is best that you give us access to your site so that we can check your Looper Provider settings and compare it to what you have (post, pages, etc) or you are trying to display with the Looper.

Best Regards.

Will do! I’ll take a look at it here and see if that matches first; I’m fairly certain I’d put that in before but WITHOUT defining a post type. If I’m unable to resolve, I’ll come back and drop the credentials.

Hey @Rule72,

Great and let us know how it goes.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.