• Hi,

    I’m new to wordpress development and I’m trying to convert html template into a wordpress. I’ve successfully created the homepage (can’t change it, just displays) and page.php and now i’m on the plans page for which i’ve created page template. It has 3 plans in it with pricing details etc. How can I add the ability to change those values and some more ?

    For eg. I created a template : page_plans and now whenever that template is used in a page, I should be able to change some values in the template. How can that be achieved in WordPress?

    Any help in right direction will be appericiated.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Values like item or plan pricing are typically saved as post meta data (aka custom fields). Thus different prices could be saved for different pages. If the same prices are to be used on several different pages throughout the site, it might make more sense to save values as options instead.

    The default UI for custom fields doesn’t make for the best user experience. Many devs put their fields in custom meta boxes that are more user friendly. Coding meta boxes is more complicated. Many devs instead rely upon a custom fields plugin which provides for a nicer UI, such as Advanced Custom Fields.

    Your template can then fetch such meta data with get_post_meta(), then after escaping it, echo it out at the appropriate spot on the page. If using the ACF plugin, it has its own function for getting meta data, get_field().

Viewing 1 replies (of 1 total)
  • The topic ‘How to allow to change values in page template’ is closed to new replies.