WordPress.org

Forums

Anarcho Notepad
[resolved] Adding year to data ribbons (7 posts)

  1. Theresa
    Member
    Posted 12 months ago #

    First: Great theme! I use it for a blog at my job and get a lot of compliments on it.

    Second: Is there a way to add the year to the red data ribbons? I found the date code in the Theme Functions but I'm new to WordPress and can't quite understand the coding.

    Thank you!

  2. Arthur Gareginyan
    Member
    Theme Author

    Posted 12 months ago #

    Hi, Theresa!
    Thanks for the nice words about my work!

    To do this, in file functions.php, find this code:

    // Red Data Ribbons
    /* Display red ribbons. */
    function anarcho_ribbons() {
        if(get_theme_mod('disable_ribbons') == '0') {
            if ( is_home() || is_category() || is_archive() || is_search() ) {
               printf( '<a href="%1$s">',
                    esc_url( get_permalink() )
               );
            }
            printf( '<div class="date-tab">
                         <span class="month">%1$s</span>
                         <span class="day">%2$s</span>
                     </div><!-- .date-tab -->',
                 esc_attr( get_the_date('F') ),
                 esc_attr( get_the_date('j') )
            );
            if ( is_home() || is_category() || is_archive() || is_search() ) {
               printf( '</a>' ); }
        }
    }
    // END-Red Data Ribbons

    and replace to this:

    // Red Data Ribbons
    /* Display red ribbons. */
    function anarcho_ribbons() {
        if(get_theme_mod('disable_ribbons') == '0') {
            if ( is_home() || is_category() || is_archive() || is_search() ) {
               printf( '<a href="%1$s">',
                    esc_url( get_permalink() )
               );
            }
            printf( '<div class="date-tab">
                         <span class="month">%1$s</span>
                         <span class="day">%2$s</span>
                     </div><!-- .date-tab -->',
                 esc_attr( get_the_date('F j') ),
                 esc_attr( get_the_date('Y') )
            );
            if ( is_home() || is_category() || is_archive() || is_search() ) {
               printf( '</a>' ); }
        }
    }
    // END-Red Data Ribbons
  3. Theresa
    Member
    Posted 12 months ago #

    Works great! Thanks!

  4. Arthur Gareginyan
    Member
    Theme Author

    Posted 12 months ago #

    You are welcome!

  5. KD Sarge
    Member
    Posted 10 months ago #

    thanks for this!

    Will the option be in future updates, or should I make sure to bookmark this page so I can come back and fix it?

    love the theme!

  6. CoffeeAddict664
    Member
    Posted 10 months ago #

    Thanks a lot for this! :D

  7. Arthur Gareginyan
    Member
    Theme Author

    Posted 10 months ago #

    You are welcome!
    Ok, I will add function for this in to customizer. It will be in version 2.11.

Reply

You must log in to post.

About this Theme

About this Topic