Title: INPUT variable as a shortcode attribute
Last modified: August 30, 2016

---

# INPUT variable as a shortcode attribute

 *  [DaveInTrinity](https://wordpress.org/support/users/daveintrinity/)
 * (@daveintrinity)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/input-variable-as-a-shortcode-attribute/)
 * Hi. I’m a complete beginner to WP, so sorry for any unintended impropriety.
 * I have a shortcode which accepts attributes. I would like the user to be able
   to input a variable (hopefully validated) and feed that to the shortcode to change
   the appearance of the plugin.
 * I have scoured the web, but am not finding anything close to leading me to a 
   solution to this. It seems to be a simple thing, if one knows how to do it.
 * Can anyone help me or point me in the right direction?
 * Thank you very much.

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

 *  [Kendall Weaver](https://wordpress.org/support/users/kendalltristan/)
 * (@kendalltristan)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/input-variable-as-a-shortcode-attribute/#post-6598543)
 * Hello Dave,
 * I need to get a little more info before I can help further so please let me know
   what you can. The better I understand your situation, the better I can help.
 * Are you asking if an end user can input something from the front end of the site
   and have it affect the output of the shortcode? If so, is it just the appearance
   that you want changed or is it something functional as well?
 * If the variable input is not on the front end, could you please let me know exactly
   where the user would input this variable?
 * Thanks in advance for the clarification and hopefully I can help out a bit.
 * Cheers.
 *  Thread Starter [DaveInTrinity](https://wordpress.org/support/users/daveintrinity/)
 * (@daveintrinity)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/input-variable-as-a-shortcode-attribute/#post-6598551)
 * Hello Kendall and thank you.
 * As I write this out, I am realizing that I don’t think this can be done without
   modifying the plugin php directly. I have a shortcode from the “Simple Real Estate
   Pack” plugin. The shortcode displays a list of schools. The usage is as follows:
 * Usage: [schoolsearch {attributes}]
 * Attributes: optional: location_title=” ” city=” ” state=” ” zip=” ” lat=” ” lng
   =” ” distance=” ” groupby=” ” output=” “
 * Important: One of the location attributes has to be defined, for example zip 
   code.
 * Ok. So I add to my page [schoolsearch zip=”34653″] and it properly displays all
   of the schools in that zip code. Perfect.
 * Now, what I’d like is to have a very generic text box (ex. Enter zip code ___
   Submit) allowing a user to enter their own zip code preference and have the plugin
   display the schools for that zip code.
 * I’m now realizing I would need some kind of page refresh, input validation, etc.
   I don’t think this can be done through WordPress.
 * Any ideas? Thanks again.
 *  [Kendall Weaver](https://wordpress.org/support/users/kendalltristan/)
 * (@kendalltristan)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/input-variable-as-a-shortcode-attribute/#post-6598561)
 * Honestly this sounds like a job for jQuery and AJAX. It _can_ be done with WordPress
   directly if you don’t mind writing some PHP, but I think the user experience 
   would suffer. AJAX exists for doing stuff like this.
 *  Thread Starter [DaveInTrinity](https://wordpress.org/support/users/daveintrinity/)
 * (@daveintrinity)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/input-variable-as-a-shortcode-attribute/#post-6598574)
 * Hi Kendall. That is above my pay grade. I have played with PHP, but nothing with
   AJAX.
 * Maybe I can find an AJAX coder on fiverr that could do this.
 * I really appreciate your help. Thank you very much for sharing your experience
   with me.
 * Dave
 *  [Kendall Weaver](https://wordpress.org/support/users/kendalltristan/)
 * (@kendalltristan)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/input-variable-as-a-shortcode-attribute/#post-6598575)
 * Best of luck.

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

The topic ‘INPUT variable as a shortcode attribute’ is closed to new replies.

## Tags

 * [input](https://wordpress.org/support/topic-tag/input/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [variables](https://wordpress.org/support/topic-tag/variables/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Kendall Weaver](https://wordpress.org/support/users/kendalltristan/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/input-variable-as-a-shortcode-attribute/#post-6598575)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
