I am very new to Wordpress. I need to update a site that has staff images added manually to every page on 50+ pages. It is time consuming for the business owner (site admin) to change one staff member. They want a component that allows one change and this change would appear on every page. Please tell me is this is the correct approach:
create a plugin that allows the admin to edit staff info
this plugin on the back end allows them to add images, add info and display current info
when the change is made, this plugin writes html/php to show-staff.php file
to display the content on every page on the front end i would then add a hook to functions.php:
add_action('get_footer', 'render_reusable');
function render_reusable() {
include 'file/path/to/show-staff.php';
}
Is this the correct approach? What is a better way to render a custom component on the front end?
I am very new to Wordpress. I need to update a site that has staff images added manually to every page on 50+ pages. It is time consuming for the business owner (site admin) to change one staff member. They want a component that allows one change and this change would appear on every page. Please tell me is this is the correct approach:
create a plugin that allows the admin to edit staff info
this plugin on the back end allows them to add images, add info and display current info
when the change is made, this plugin writes html/php to show-staff.php file
to display the content on every page on the front end i would then add a hook to functions.php:
add_action('get_footer', 'render_reusable');
function render_reusable() {
include 'file/path/to/show-staff.php';
}
Is this the correct approach? What is a better way to render a custom component on the front end?
Share Improve this question edited Feb 11, 2020 at 20:32 Tom J Nowell♦ 61.2k7 gold badges79 silver badges148 bronze badges asked Feb 11, 2020 at 14:56 VilleLipponenVilleLipponen 1033 bronze badges1 Answer
Reset to default 2I can think of two much simpler, more "WordPress way" approaches.
First approach: create a custom theme or a child theme, and make a custom footer with room for widgets. This way, the business owner will be able to go in and edit a single widget with whatever photos and other updates are needed, and they will apply sitewide.
Second approach: create a Reusable Block.
In the Block Editor, you can create the full grouping of staff photos (and whatever other info is needed) inside of a single Group block. Once it's created, you can save it as a Reusable Block, and add it to every Page/Post/wherever it needs to be added. Whenever you need to make updates, you can simply open up the one Reusable Block, make the updates, and save them - and voila, it will be updated every single place that reusable block has been added.
Both require no coding skills or special technical knowledge, and both can be completed by anyone with Editor rights (a.k.a. the business owner).