Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • Dirk
    Participant

    Hi,

    I have the task to build a page with various content/Shortcode snippets which shall all have the same parameter. That parameter is delivered to the page by URL parameter. How can I achieve this?

    e.g. mywebsite.com/detailpage?product=33

    The shortcodes in the page should all get the 33 as parameter:
    [sc producttitle="33"]
    [sc producttext="33"]
    [sc productpic="33"]

    Many thanks!!!!

    Hi Dirk,

    So I guess you want to avoid typing the same attribute for every shortcode.

    Yes in that case you can use “custom fields” shortcode parameter.

    Shortcode parameters

    Insert a custom field named “postid” with value “33” in your page.

    Now use $$custom_field:postid$$ in your shortcode content. When you insert this shortcode in the post, this parameter will be replaced by 33 which is taken from the page’s custom field.

    Thanks,
    Aakash

    Dirk
    Participant

    Hello Akash,

    thank you for your response. I actually need to design a page with lots of shortcodes which should get the same parameter – in this example “33”. But that numer shall be derived from the URL-parameter.

    I always call the same page but with different numbers and the content is displayed depending on the parameter. I need to get the URL parameter into the shortcode(s) as parameter.

    regards, Dirk

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Subscribe for updates

Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam. View newsletter