Change text "Category Archive" on Category pages to be the Category Title

  • raindance

    #2148

    Hi

    Anyone know how to change the text at the top of a category page from Category Archive to be the title of the Category itself?

    I saw a forum posting elsewhere that said to put this in the archive file which I made one in my child theme folder, archive.php and added the following but it didn’t do anything…clearly I must be doing it wrong or on the wrong track.

    Anyone know?

    Thanks

    Laura

    raindance

    #18952

    Also same issue for the breadcrumbs which read:

    Home > Archive by category ‘Test’

    What if I just want it to say the category name not the Archive by category part? And without the quotes?

    I’m using BreadcrumbNavTxt

    raindance

    #18953

    Sorry one more thing,

    How do I get rid of the grey space between the bottom of the blue gradient bar containing the title text “Category Archive: Test” and the top of the white page in other words so that the blue title gradient bar would be flush with the white top of the content area?

    http://juicytravels.com/category/test/

    raindance

    #18954

    Breadcrumb part solved. Easily removed in the settings page of BeadcrumbNavTxt.

    But I’m still stuck on how to remove the words “Category Archive:” from the title bar, and how to make the grey bar flush with the white part.

    Anyone?

    raindance

    #18955

    Ok flush issue solved:

    I just added this to my child css:

    .archive .page-title {

    margin-bottom: 0px;

    }

    Now just stock on how to remove the words “Category Archive:”

    ?

    raindance

    #18956

    Not sure if this is the best way to do it but I made a child theme version of category.php and just took the words “Category Archives: ” out.

    Mod

    Kenneth John Odle

    #18957

    No, it’s not really the best way, because you’ll miss out on changes to the category.php file in the next update (or you’ll have to redo your work). But it works for now, which is the important thing.

    It might be possible to do this with a filter somehow, but I haven’t looked into it that much yet. You can change some WP text like this (see this post, for example), but I don’t know if it’s possible with the Graphene theme itself.

    Admin

    Syahir Hakim

    #18958

    Insert this into your child theme’s functions.php file:

    function graphene_filter_gettext( $translated, $original, $domain ) {
    $strings = array(
    'Category Archive: <span>%s</span>' => '<span>%s</span>',
    );
    if ( ! empty( $strings[$original] ) ) {
    $translations = &get_translations_for_domain( $domain );
    $translated = $translations->translate( $strings[$original] );
    }
    return $translated;
    }
    add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );

    Basically every text string in the theme is passed through WordPress first so that the strings can be translated properly into the 20+ languages Graphene theme is available in. The function above just makes use of the WordPress function that translates the strings to change the original text string to a custom one.

    Mod

    Kenneth John Odle

    #18959

    Well, there you go. Thanks, Syahir.

    For those who are interested, this line:

    'Category Archive: <span>%s</span>' => '<span>%s</span>',

    is what controls that text. For example, I changed it to:

    'Category Archive: <span>%s</span>' => 'All my posts from the '<span>%s</span>' category',

    which now looks like this:

    That’s just full of awesome!

    Anonymous

    #18960

    Dangit!! I want Syahir’s knowledge on how he comes up with these functions!!

    Thanks, my friend.

Viewing 10 posts - 1 through 10 (of 17 total)
  • You must be logged in to reply to this topic.
Do NOT follow this link or you will be banned from the site!