• 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)
  • 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

    (@daveintrinity)

    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.

    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

    (@daveintrinity)

    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

    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.