• Resolved Ike Ten

    (@ike-ten)


    Hi Tom,

    Am using this code

    add_filter( 'single_cat_title', 'generate_custom_archive_title' );
    function generate_custom_archive_title( $text ) {
      if ( !is_admin() && is_archive() )
        return $text . 'Archive';
        
      return $text;
    }

    To add text to append text to archive title . It works but returns markup like this <header class"page-header"> <h1 class="page-title"> Uncategorized Archive</h1> </header>

    The desired output is for the text to be prepended and wrapped in it’s own h tag not appended at the end.

    Example <header class="page-header"> <h2 class="prepend-page-title">Archive</h2><h1 class="page-title"> Uncategorized</h1> </header>

    I have tried using the ‘generate_archive_title’ to insert the prepend text but it’s gets outside the <header> tag.

    Kindly assist.

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Prepend Archive Titles with Markup’ is closed to new replies.