WordPress.org

Make WordPress Core

Ticket #9702: 9702-new.patch

File 9702-new.patch, 2.8 KB (added by ramiy, 5 years ago)

the latest version (for wp3)

  • wp-content/themes/default/archive.php

     
    1313 
    1414          <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> 
    1515          <?php /* If this is a category archive */ if (is_category()) { ?> 
    16                 <h2 class="pagetitle">Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category</h2> 
     16                <h2 class="pagetitle">Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category <?php edit_category_link('Edit', ' | ', ''); ?></h2> 
    1717          <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> 
    18                 <h2 class="pagetitle">Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h2> 
     18                <h2 class="pagetitle">Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217; <?php edit_tag_link('Edit', ' | ', ''); ?></h2> 
    1919          <?php /* If this is a daily archive */ } elseif (is_day()) { ?> 
    2020                <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2> 
    2121          <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> 
  • wp-includes/link-template.php

     
    609609} 
    610610 
    611611/** 
     612 * Retrieve edit category link. 
     613 * 
     614 * @since 3.0.0 
     615 * 
     616 * @param int $category_id Category ID 
     617 * @return string 
     618 */ 
     619function get_edit_category_link( $category_id = 0, $taxonomy = 'category' ) { 
     620        $category = get_term($category_id, $taxonomy); 
     621 
     622        if ( !current_user_can('manage_categories') ) 
     623                return; 
     624 
     625        $location = admin_url('categories.php?action=edit&amp;amp;taxonomy=' . $taxonomy . '&amp;cat_ID=' . $category->term_id); 
     626        return apply_filters( 'get_edit_category_link', $location ); 
     627} 
     628 
     629/** 
     630 * Display or retrieve edit category link with formatting. 
     631 * 
     632 * @since 3.0.0 
     633 * 
     634 * @param string $link Optional. Anchor text. 
     635 * @param string $before Optional. Display before edit link. 
     636 * @param string $after Optional. Display after edit link. 
     637 * @param int|object $category Tag object or ID 
     638 * @return string|null HTML content, if $echo is set to false. 
     639 */ 
     640function edit_category_link( $link = '', $before = '', $after = '', $category = null ) { 
     641        $category = get_term($category, 'category'); 
     642 
     643        if ( !current_user_can('manage_categories') ) 
     644                return; 
     645 
     646        if ( empty($link) ) 
     647                $link = __('Edit This'); 
     648 
     649        $link = '<a href="' . get_edit_category_link( $category->term_id ) . '" title="' . __( 'Edit tag' ) . '">' . $link . '</a>'; 
     650        echo $before . apply_filters( 'edit_category_link', $link, $category->term_id ) . $after; 
     651} 
     652 
     653/** 
    612654 * Retrieve the permalink for the feed of the search results. 
    613655 * 
    614656 * @since 2.5.0