WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Page_Title in Shortcode (2 posts)

  1. csbecker
    Member
    Posted 2 years ago #

    I'm trying to do something special with Shortcodes (what else is new) and I don't have the facility with PHP as I would like, but I believe shortcodes is what will help me. I have a client's website where they want to sell products, I have created a POST or PAGE for each product. I want to use shortcodes to dynamically build "Add to Cart" (PayPal) buttons that include the name of the Page or Post so I don't have to create many buttons (like 400+). So is there a way to do something like this?
    Create a shortcode in my functions.php like the following:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    This line:
    <input type="hidden" name="item_name" value="Trip Deposit - Page Title">
    Is where I would like to dynamically put the website's page's title.

    Does this make sense and can you assist?

    I'm also wondering if I would have to change the double quotes within the echo to single quotes to make the shortcode work.

    Can anyone help me build this shortcode?

    Thanks! Chris

  2. csbecker
    Member
    Posted 2 years ago #

    Code for my original question above.

    [Code moderated as per the Forum Rules. Please use the pastebin]

Topic Closed

This topic has been closed to new replies.

About this Topic