Archived topic
Breadcrumbs in template
5 replies · Started by Matthew on August 19, 2020
How can I get breadcrumbs in a specific location of a template?
So far I have a hook for the Media location with 'generate_after_main_content'.
It's close but I would like to precisely put the breadcrumbs into a div.
Hi there,
Not sure if I fully understand.
Using hook is definitely the correct method.
It’s close but I would like to precisely put the breadcrumbs into a div.
Which div are you trying to add it in?
Is there the ability to position the breadcrumb where I want.
See the picture below. The breadcrumbs are there according to the hook but can it go into the div above it. Its just a normal div in my template file for media attachments.
https://drive.google.com/file/d/145YM6I4WwDttIhx1ZvFcCfB6hRJusJk7/view?usp=sharing
Alternatively can I box it so it has a background and is not floating on the main page background area. Also centered possibly as well.
Hi there,
the generate_after_content hook is within the article container.
OK generate_after_content is actually a good spot for my blog but I am still wondering if i can tailor a location of my own for the attachment template.
What's "Custom Hook" under the hook drop-down? Can I create one name it and use the code where I want it, i.e.
<?php
/**
* my_custom_name hook.
*
* @since 0.1
*/
do_action( 'my_custom_name' );
?>
Yes, if its a custom template then you can add the do_action code where you require it.
Then you can select Custom Hook and Enter its my_custom_name