0

I'm trying to figure out a way to call a custom field that is given a value in the back end but I'm getting no where right now. I know how to display it using PHP but not how to create a shortcode to display it.

I'm hoping to create a custom field and present the value on the front end of my website by using a shortcode in the text.

For Example:

Custom Field = local_area

Value = Liverpool

Then within the page, write "If you're looking for builders in [local_area] call ..." - This will then display "Liverpool" - Then I can create multiple pages / areas and simply change the Custom Field value to whatever area I require.

Is this possible?

Kind Regards, Dean

  • Edit your question to show what you've tried. – Milo Oct 3 '17 at 15:43
0

There is a plugin called Just Variables - which is doing just that https://wordpress.org/plugins/just-wp-variables/ - you can have a look at its code and it will provide you with the best explanation on how to do that. (or you can alternatively just use the plugin.)

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.