- This topic has 8 replies, 4 voices, and was last updated 4 years, 1 month ago by
Tom.
-
AuthorPosts
-
May 1, 2019 at 5:06 pm #886028
Henry
This may or may not be a GP issue, but anyways here goes!
I am using the Pods Framework to create Custom Post Types and Taxonomy which works great with GP.
Within a Custom Taxonomy I made, which is called ‘US States’ GP or Pods injects the title of the Taxonomy within the
<h1 class="page-title">
tag. If I manually change the title then the title or content that I insert is simply appended to the injected default title.So, in other words, the bolded code below is the admin internal title given to this Custom Taxonomy and I’d like to hide it:
<header class="page-header"> <h1 class="page-title"> REMOVE THIS >> US State:<<<< Cybersecurity Conferences in Alabama </h1> <div class="taxonomy-description"><p>This is our directory for all IT Security, Events and Conferences that take place in the State of Alabama.</p> </div> </header>
Any ideas on how to do this?
Thanks!!!
May 2, 2019 at 5:24 am #886452Henry
In fact – update – it is a GeneratePress thing (I contacted Pods).
The question I should be asking is: “How do I adjust the filter since this is a Taxonomy archive”
Any ideas? Thanks!
May 2, 2019 at 5:32 am #886459Henry
I think the automatic title description (which is injected into the header tag) is from
the_title()
so I’d like to hide that injected bit and just allow the regular insertion of text via the backend – if that’s possible!Thanks!
May 2, 2019 at 7:12 am #886691Leo
StaffCustomer SupportHi there,
Can you give this a shot and let me know if this works for you?
https://docs.generatepress.com/article/layout-element-overview/#disable-elementLet me know ๐
May 2, 2019 at 6:37 pm #887267Henry
Thanks – I tried that but it seems that I am missing ‘disable elements’ > https://prnt.sc/njr3q6
Any idea how to fix?
May 3, 2019 at 3:09 am #887622David
StaffCustomer SupportHi there,
make sure you have the Disable Elements module activated in Appearance > GeneratePress.
May 3, 2019 at 4:40 pm #888393Henry
Thanks David.
It didn’t work.
I suspect the reason is that I am referring to custom taxonomy ‘archive’ listings that perhaps GP doesn’t pick up using Elements? Could that be the case? The simple solution I guess is to hide the title-tag html but I’d have to do that via the functions.php and identify the taxonomy ID I guess…
May 4, 2019 at 2:29 am #888605Henry
This code worked:
add_filter( 'get_the_archive_title', 'my_theme_archive_title' ); /** * Remove archive labels. * * @param string $title Current archive title to be displayed. * @return string Modified archive title to be displayed. */ function my_theme_archive_title( $title ) { if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { $title = '<span class="vcard">' . get_the_author() . '</span>'; } elseif ( is_post_type_archive() ) { $title = post_type_archive_title( '', false ); } elseif ( is_tax() ) { $title = single_term_title( '', false ); } return $title; }
Do you see any harm using this? Thanks
May 4, 2019 at 7:30 am #888928Tom
Lead DeveloperLead DeveloperThat looks good to me ๐
-
AuthorPosts
- You must be logged in to reply to this topic.