Archived topic
Insert Text Above Archive Title
3 replies · Started by Maria on April 12, 2018
How would I insert text above the Archive Title? I want to add a phrase or an image above the category title. I tried this, but I don't know what I'm doing.
add_filter( 'get_the_archive_title', 'mj_insert_text_above_title' );
function mj_insert_text_above_title( $title ) {
if ( is_post_type_archive() ) {
echo 'The Categories';
}
}
Hi Maria.
Hmm try the before header content hook instead:
http://demo.generatepress.com/hook-locations/
https://docs.generatepress.com/article/hooks-overview/
Then you will need to use conditional tags:
https://docs.generatepress.com/article/using-hooks-conditional-tags/
https://codex.wordpress.org/Conditional_Tags#Any_Archive_Page
Let me know if this helps.
That helped. Just what I needed. Thank you!
No problem :)