I know I can add PHP to the functions file. And I know I can make a plugin.
I basically need to make a calculator of sorts and send the values to an email signup.
What is the best way to achieve this. I think a plugin, but then how would I position the plugin at a place on an already existing page?
Sorry if this is a noob question, I really want to understand the correct way to achieve this before starting.
I know I can add PHP to the functions file. And I know I can make a plugin.
I basically need to make a calculator of sorts and send the values to an email signup.
What is the best way to achieve this. I think a plugin, but then how would I position the plugin at a place on an already existing page?
Sorry if this is a noob question, I really want to understand the correct way to achieve this before starting.
Share Improve this question asked Feb 5, 2021 at 18:53 EoinEoin 1156 bronze badges1 Answer
Reset to default 1A plugin is just a file that gets loaded into WordPress, it doesn't have a location on the page. In fact WordPress doesn't know which page it is yet when plugins are loaded. It may not even be a frontend page!
So if a plugin is just a place to put code such as hooks and filters, how do you embed code in a page?
There are several methods:
- blocks
- shortcodes
- widgets
- theme template files
You can register blocks/shortcodes/widgets in a plugin, whereas templates files are theme specific.
I recommend searching the site for how to create and use a shortcode, this will be the easiest option for you at the moment.