[Resolved] Remove 'injection' of a archive title into my archive

Home Forums Support [Resolved] Remove 'injection' of a archive title into my archive

Home Forums Support Remove 'injection' of a archive title into my archive

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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!!!

    #886452
    Henry

    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!

    #886459
    Henry

    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!

    #886691
    Leo
    Staff
    Customer Support

    Hi 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-element

    Let me know ๐Ÿ™‚

    #887267
    Henry

    Thanks – I tried that but it seems that I am missing ‘disable elements’ > https://prnt.sc/njr3q6

    Any idea how to fix?

    #887622
    David
    Staff
    Customer Support

    Hi there,

    make sure you have the Disable Elements module activated in Appearance > GeneratePress.

    #888393
    Henry

    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…

    #888605
    Henry

    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

    #888928
    Tom
    Lead Developer
    Lead Developer

    That looks good to me ๐Ÿ™‚

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.