Trying to find some confirmation on how this is possible within the confines of a plugin without success:
The goal is for a user to use a plugin that would insert a pre-defined snippet of code in a selected part of the layout. A typical use would be:
- User selects “Below header”
-
Included code appears below header
-
User selects “Above footer”
- Included code appears above footer
The “code” snippet would be something like a set of links, or an image. So that they could select from a drop-down menu, where it should appear on their site without editing any theme code.
I suppose it would also be useful to provide a tag that devs can paste somewhere in their theme template to be included somewhere more complicated, something like .
In WordPress, you can modify the output of the system in particular places, by using action hooks and filters. For instance:
This PHP code, would modify the footer by adding a custom action [function], which WordPress would fire right at the event called “wp_footer”, which is self explanatory. There are hooks and filters for all kinds of things. WordPress has a rich feature set for modifying just about everything. This kind of code can go in either a theme, or a plugin. Check out the codex here: https://codex.wordpress.org/Plugin_API/Action_Reference
Write a shortcode function in function.php
Now you can add [test_shortcode] any where in you editor to get the result there
Or in the template you can call it with
Hope this will help you to solve your problem
You are looking for register_sidebar function.
You can create named sidebar area with this function and put any widgets to it from Apperarence -> Widgets (in wp-admin). In your theme files you can call dynamic_sidebar in place you want, and all widgets will be appeared in this place.