Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4290

    Is it possible to customize the archive.php file so that the word “(A-Z)” appears at the end of the category archive text string (#top .superheading)? My category posts are sorted alphabetically with a plugin that I’m using and I was hoping to make a small text label indicating that.

    The format of the category archive text string that I would like to setup:

    Archive For Salt Water Taffy Recipes (A-Z)

    Example page where the category archive label appears:

    http://tinyurl.com/5vuwzhy

    I played around with the archive.php code by couldn’t get it formatted correctly.

    $output = “”;

    $useTemplate =”";

    if (is_category()) {

    $output = __(‘Archive For ‘,’habitat’).single_cat_title(”,false);

    } elseif (is_day()) {

    $output = __(‘Archive For ‘,’habitat’).get_the_time(‘F jS, Y’);

    } elseif (is_month()){

    $output = __(‘Archive For ‘,’habitat’).get_the_time(‘F, Y’);

    } elseif (is_year()) {

    $output = __(‘Archive For ‘,’habitat’).get_the_time(‘Y’);

    } elseif (is_search()) {

    $output = __(‘Search Results’,'habitat’);

    } elseif (is_author()) {

    $output = __(‘Author Archive’,'habitat’);

    } elseif (isset($_GET) && !empty($_GET)) {

    $output = __(‘Blog Archives’,'habitat’);

    } elseif(is_tax()){

    $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) );

    $output = __(‘Archive For ‘,’habitat’).$term->name;

    $useTemplate = $term->slug;

    #45733

    Hey,

    in archive.php replace following line:

    if($output != "") $output = '<h2 class="superheading">'.$output.'</h2>';

    with:

    $pos = strpos($output,"Archive");

    if(($pos === false) || (is_day() || is_month() || is_year())) {
    if($output != "") {$output = '<h2 class="superheading">'.$output.'</h2>';};
    }
    else {
    if($output != "") {$output = '<h2 class="superheading">'.$output.' (A-Z)</h2>';};
    }

    #45734

    Thanks Dude, it worked great.

    Would it be possible to exclude the dated Archives from this “(A-Z)” change? For example to keep the text change to the category archives but to remove it from the following dated archive sections below:

    April 2011 (3)

    February 2011 (11)

    January 2011 (13)

    #45735

    I adjusted the code above – please try it again.

    #45736

    Awesome! Thanks.

    #45737

    Glad that I could help you :)

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Category Archive Page Text Add’ is closed to new replies.