• Resolved gwcooper

    (@gwcooper)


    I’m trying to use a shortcode to access a single value in an ad. I read https://wpadvancedads.com/manual/shortcodes/ which mentions options you can change within the shortcode but not necessarily how to use them. Is there any way I can use these options to specify a certain value from the ad I’m using in the shortcode and only return that value? For example, can I customize the shortcode to only return the first line of the referenced ad? or somehow store a variable in the ad and return only that value that is stored in the variable? I would ideally have several shortcodes referencing this one ad that contains several values (these values need to be updated frequently), so I only have to update the one ad instead of all references to those values.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Gwcooper,

    Thanks for reaching out.

    Can you please be more specific or give an example what you want to achieve? Which values you have in mind?

    If you look for way to call ads within another ad you can also use the shortcode from the first ad within another one.

    If you want to store additional information about your ads maybe this approach on adding custom meta boxes suits your needs.

    Best regards,
    Henning

    Thread Starter gwcooper

    (@gwcooper)

    Hi Henning,

    Thank you for your reply. In my particular case, I have headling APR rates for loans listed in ads (and also in tables and other places on my site). The values I want to store are the minimum and maximum variable APR and the minimum and maximum fixed APR (4 values) for about 10 different products (~40 values). These values update frequently and I would like a single place where I can update all of them at once, so if one product needs to updates its rates, I don’t have to manually update all of the ads and tables that contain those rates. I’m trying to do this through an ad shortcode since I want it to be editable by non-admins of the site but I realize this might be a strange way to do this. In reality, I want to store a variable and use that variable all over the site.

    One ad would look like this (not visible to public):
    APR1: 2.00
    APR2: 5.99
    APR3: 2.50

    And then the actual public ad would look something like this:
    “The starting variable rate is [shortcode APR1]%”
    so in the public view, it would show
    “The starting variable rate is 2.00%”

    But I haven’t figured out how to only show part of the referenced ad with the shortcode. It would bring in all of the rates.

    Hi Gwcooper,

    Thanks for the reply.

    This would not be possible using only Advanced Ads without extra coding this functionality.

    I’d suggest building this using Advanced Custom Fields, custom meta boxes, and their shortcode features:

    I hope you find a solution that works for you!

    Best regards,
    Henning

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom options for shortcodes’ is closed to new replies.