Skip to content

Instantly share code, notes, and snippets.

@allysonsouza
Last active June 6, 2017 09:49
Show Gist options
  • Select an option

  • Save allysonsouza/572ebf20a356b063473a to your computer and use it in GitHub Desktop.

Select an option

Save allysonsouza/572ebf20a356b063473a to your computer and use it in GitHub Desktop.

Revisions

  1. allysonsouza revised this gist Jun 16, 2014. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion archive-conditionals.php
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    <?php

    function archive_title() {

    //Conditionals to Title Display in WordPress Archive Templates
    @@ -19,4 +21,6 @@ function archive_title() {
    return 'Archives';
    }

    }
    }

    ?>
  2. allysonsouza revised this gist Jun 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion archive-conditionals.php
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ function archive_title() {
    }

    //Fallback if there's no archive matching the conditions
    return __('Archives', 'odin');
    return 'Archives';
    }

    }
  3. allysonsouza revised this gist Jun 16, 2014. 1 changed file with 18 additions and 18 deletions.
    36 changes: 18 additions & 18 deletions archive-conditionals.php
    Original file line number Diff line number Diff line change
    @@ -1,22 +1,22 @@
    //Conditionals to Title Display in WordPress Archive Templates
    if( is_archive() ) {
    function archive_title() {

    $queried_object = get_queried_object();

    if( is_tag() ) {
    $slug = $queried_object ? $queried_object->slug : ' ' ;
    } else if( is_tax() ){
    $slug = $queried_object ? $queried_object->slug : ' ' ;
    } else {
    $slug = $queried_object ? $queried_object->rewrite['slug'] : ' ' ;
    }

    if( $slug ) {
    return ucfirst($slug);
    //Conditionals to Title Display in WordPress Archive Templates
    if( is_archive() ) {
    $queried_object = get_queried_object();

    if( is_tag() ) {
    $slug = $queried_object ? $queried_object->slug : ' ' ;
    return ucfirst( $queried_object->name );
    } else if( is_tax() ){
    $slug = $queried_object ? $queried_object->slug : ' ' ;
    return ucfirst( $queried_object->name );
    } else {
    $slug = $queried_object ? $queried_object->rewrite['slug'] : ' ' ;
    return $queried_object->labels->name;
    }

    //Fallback if there's no archive matching the conditions
    return __('Archives', 'odin');
    }

    //Fallback if there's no archive matching the conditions
    return 'Archives';

    }
    }
  4. allysonsouza revised this gist Jun 16, 2014. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions archive-conditionals.php
    Original file line number Diff line number Diff line change
    @@ -16,8 +16,7 @@
    }

    //Fallback if there's no archive matching the conditions
    echo '<img src="'. latitude_imgs().'/default.jpg" />';
    return;
    return 'Archives';

    }
    }
  5. allysonsouza renamed this gist Jun 16, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. allysonsouza created this gist Jun 16, 2014.
    23 changes: 23 additions & 0 deletions archive-conditionals
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    //Conditionals to Title Display in WordPress Archive Templates
    if( is_archive() ) {

    $queried_object = get_queried_object();

    if( is_tag() ) {
    $slug = $queried_object ? $queried_object->slug : ' ' ;
    } else if( is_tax() ){
    $slug = $queried_object ? $queried_object->slug : ' ' ;
    } else {
    $slug = $queried_object ? $queried_object->rewrite['slug'] : ' ' ;
    }

    if( $slug ) {
    return ucfirst($slug);
    }

    //Fallback if there's no archive matching the conditions
    echo '<img src="'. latitude_imgs().'/default.jpg" />';
    return;

    }
    }