Title: Getting parameters from query-string
Last modified: August 31, 2016

---

# Getting parameters from query-string

 *  [ploughansen](https://wordpress.org/support/users/ploughansen/)
 * (@ploughansen)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/getting-parameters-from-query-string/)
 * Is it possible to get the value from parameters in a query-string?
 * Example:
    I have an url like this: [http://www.example.com/?name=George&city=Washington](http://www.example.com/?name=George&city=Washington)
 * The content of the page is:
 * Hello George. You live in Washington.
 * Is there an option in your plugin to show this?
 * Thanks.
 * [https://wordpress.org/plugins/custom-content-shortcode/](https://wordpress.org/plugins/custom-content-shortcode/)

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

 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/getting-parameters-from-query-string/#post-6976133)
 * Yes, this feature is hidden deep in the documentation: Advanced -> Pass -> Query
   variables.
 *     ```
       [pass global=query fields=name,city]
         Hello {NAME}. You live in {CITY}.
       [/pass]
       ```
   
 *  Thread Starter [ploughansen](https://wordpress.org/support/users/ploughansen/)
 * (@ploughansen)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/getting-parameters-from-query-string/#post-6976183)
 * Thanks, this works.
 * Related question: One of the values in the querystring is a date and a time in
   unix format (ex. ‘20160128’ and ‘1201’). Can your plugin format these values 
   into something more readable (like 2016/01/28 or 28-01-2016) (and time like 12:
   01)?
 * Also, another value is amount as integer value. So 1,234.56 is written as 123456.
   Can your plugin perform basic calculation? That way I could divide by 100 and
   get the correct value.
    It would be really nice if the value could be formatted
   as a number with a fixed decimal.
 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/getting-parameters-from-query-string/#post-6976185)
 * Currently the plugin doesn’t have a way to format dates/numbers from query strings,
   or do calculations. Especially calculations would be hard to achieve with shortcodes,
   it’d be simpler done with PHP.
 * That said, your questions gave me some ideas, so I’ll see if it’s possible. I’ll
   post here if/when the feature is included.
 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/getting-parameters-from-query-string/#post-6976209)
 * In the newest plugin update, I added a feature to format dates and numbers, as
   well as an optional module to do calculations.
 * To format a value like 20160128 into 2016/01/28
 *     ```
       [format date=Y/m/d] {DATE} [/format]
       ```
   
 * To format a value like 1201 into 12:01
 *     ```
       [format date=H:i] {TIME} [/format]
       ```
   
 * To format a number with 2 decimal places
 *     ```
       [format decimals=2] {NUMBER} [/format]
       ```
   
 * To do a calculation, the optional Math module must be enabled in Settings. The
   result can then be formatted.
 *     ```
       [format decimals=2] [calc] {NUMBER} / 100 [/calc] [/format]
       ```
   
 *  Thread Starter [ploughansen](https://wordpress.org/support/users/ploughansen/)
 * (@ploughansen)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/getting-parameters-from-query-string/#post-6976210)
 * That’s amazing. I can’t wait to try this.
 * Will let you know how it works!
 * Thanks 🙂
 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/getting-parameters-from-query-string/#post-6976211)
 * There is documentation about `[format]` in Advanced -> Extras, and about `[calc]`
   in Optional -> Math.
 * At first, I was hesitant to include a calculation feature, because I’m trying
   to keep the plugin compact and focused. But I found a light-weight and safe math
   module, and I figured if it’s optional, people can enable it only when needed.
   It looks like it could be pretty useful, to calculate things based on field values.

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

The topic ‘Getting parameters from query-string’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

## Tags

 * [Query String](https://wordpress.org/support/topic-tag/query-string/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * 6 replies
 * 2 participants
 * Last reply from: [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/getting-parameters-from-query-string/#post-6976211)
 * Status: not resolved