Changing IMG Name based on Query Param
-
I have a small issue using Query Params in WordPress.
I’m using URL Params Plugin By Jeremy B. Shapiro.
I want to display Text based on the URL param.
I used [urlparam param=”region” default=”No Region Found” /] – Which displays correctly in my page.
Ex. URLdotCOM/blog/?region=Texas , displays “Texas” where ever I put [urlparam param=”region” default=”No Region Found” /] in my Page.
Works, Great.
The issue is when I try to use a param to replace the IMG name.
Code:
div class="wp-block-image"><figure class="alignright is-resized"><img [urlparam="" attr="src" param="region" ]=""></figure></div>
When I use this code, It comes out as not a .jpg and it tries to link to URLdotCOM/Blog-Post-Name/Texas
Two problems here.
My Code doesn’t put the .jpg beside the region to make it an image.
My Code is linking to /Blog-Post-Name/ instead of /wp-content/uploads/2019/01/
I tried to use:
/wp-content/uploads/2019/01/[urlparam attr=”src” param=’region’].jpg in my Page HTML code but that breaks up the Code.
Any help is greatly appreciated.
- The topic ‘Changing IMG Name based on Query Param’ is closed to new replies.