You need to use the hook __before_main_container
.
Featured Pages have priority 10 and breadcrumb priority 20.
So basically you can do this in your functions.php of your child theme.
add_action('__before_main_container', 'my_section', 1);
function my_section(){
/* create html block*/
$html = <p>Hello World</p>;
echo $html;
}
@d4z_c0nf’s solution will work. If I may add to it / modify it:
If you’re new to website development, you might want to read the Customizing Customizr article first.
Additionally, if you are going to be changing the specials frequently, it would probably be better to add a widget that can contain your html, rather than adding the html directly in your functions.php file. That way, there’s less chance that a slight syntax error will bring your site down each time you make a change (php is best written/tested once and left alone thereafter).
There is a snippet on the Customizr site that shows you how to add a widget area after the header.
As d4z_c0nf suggests, you can use the __before_main_container
“hook” to put your widget area before the featured pages bubbles. So in the article I link to, substitute __after_header
with __before_main_container
and your widget area will then be in the right place.
You can then drag a text widget into the area using Appearance > widgets (you can enter html in a text widget).
You will end up with a text widget that’s easily updated from the WordPress dashboard.
Good luck!
Late Reply to this, and this is really good, and informational but I believe some minor edits for future uses will be needed to correctly function (as php and html need to be separated slightly) how does this work for ya?
function plan_description(){
/* create html block for before main container*/
echo '<p>Hello World</p>';
Thanks for the information and take care!!
echo_jeromy, you mean that I missed quotes? Yes, you’re right.
Question, when I add d4z_c0nf code, “hello world” appears on every page for me, how come?
‘Cause that filter is general. Want it for a specific page? You need something like this:
add_action('__before_main_container', 'my_section', 1);
function my_section(){
if (is_page(page_id_or_slug_or_name)){
/* create html block*/
$html = "<p>Hello World</p>";
echo $html;
}
}
Thanks that was what I was looking for! 🙂
Hi @d4z_c0nf, I’m impressed by your support involvement those last days.
You seem to have excellent CSS, PHP, WP skills. Thanks to share them with the Customizr users!
If you think you can bring something new to ThemesandCo (snippet, tuto, guide…), like a few other people in this forum, feel free to contact me here : http://www.themesandco.com/contact/. I’ll be glad to get in touch!
Best!