Support » Plugin: Custom Content Shortcode » how image based on url query string

  • jpstudiodesigns

    (@jessicapschultz)


    hello, I was thinking I can show an image file based on the url with a query string using global=query but I cannot find a solution. I have a website that many companies will visit based on a unique query string they are given like:
    website.com?employer=bfe, then based on what the value of “employer” is, their logo will show. I have something in place but it is not ideal since it is based on display: none then it shows. I want the logo to only load when the query is present, not hidden then shown. Note: there could be 50 or 200 different query strings/different companies.

    is it possible with this plugin? can I get help with the example?
    I would love any possible solutions 🙂
    this is my dummy guess that does not work obviously or possibly give you an idea of what I need:

    [pass global=query]
      [if pass='{query}' value=bfedemo]
        <img src="https://jessicas31.sg-host.com/wp-content/uploads/2021/04/logo-bfedemo.png">
      [/if]
    [if pass='{query}' value=onelife]
        <img src="https://jessicas31.sg-host.com/wp-content/uploads/2021/04/logo-onelife.png">
      [/if]
    [if pass='{query}' value=mspark]
        <img src="https://jessicas31.sg-host.com/wp-content/uploads/2021/04/logo-mspark.png">
      [/if]
    [/pass]

    perhaps I need to load the image urls into custom field?

Viewing 1 replies (of 1 total)
  • polarracing

    (@polarracing)

    You where close already – just some little changes to get the right syntax:

    1. Passed values have to written in capital-letters.
    2. Values should be wrapped in ”
    3. Passed globals are called with FIELD

    If its not working, make sure “query” is defined.

    [pass global=query]
      [if pass='{FIELD}' value='bfedemo']
        <img src="https://jessicas31.sg-host.com/wp-content/uploads/2021/04/logo-bfedemo.png">
      [/if]
    [if pass='{FIELD}' value='onelife']
        <img src="https://jessicas31.sg-host.com/wp-content/uploads/2021/04/logo-onelife.png">
      [/if]
    [if pass='{FIELD}' value='mspark']
        <img src="https://jessicas31.sg-host.com/wp-content/uploads/2021/04/logo-mspark.png">
      [/if]
    [/pass]
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.