Creating a Variable for a Shortcode
-
hey guys, I am NOT a coder by any means, but I’m trying to make this happen.
I have a number tied to locations we service and it changes and instead of changing it on 300 pages, I’d like to change it in one spot, and replace those 300 locations with a variable or shortcode.
I have found this code, but, I’m not sure how I should use it. I’d like to be able to use something like [varFSL] as my shortcode, and I think this code will let me do that, but I don’t know what the $i is all about, I thought that was an increment?
function my_shortcode_function() { $i = '<p>Hello World!</p>'; return $i; } add_shortcode('my-shortcode', 'my_shortcode_function');
Obviously I’d change hello world to make sure it reads with my info, but in this example, I would use [my-shortcode]
so, in my attempt to edit this I would do it like this.
function var_FSL_function() { $name = '<p>700+</p>'; return $i; } add_shortcode('varFSL', 'var_FSL_function');
Is that correct?
I will plug this into functions.php and then use the [varFSL] where I need it. Correct?Thank you in advance!! I’m so sorry I’m not a coder, but I promise, I’m trying like mad!!
The page I need help with: [log in to see the link]
- The topic ‘Creating a Variable for a Shortcode’ is closed to new replies.