Make WordPress Core

Changeset 8910


Ignore:
Timestamp:
09/17/2008 12:04:02 AM (16 years ago)
Author:
ryan
Message:

Edit and Delete links for categories. see #7552

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r8908 r8910  
    8181    $pad = str_repeat( '— ', $level );
    8282    $name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
     83    $edit_link = "categories.php?action=edit&cat_ID=$category->term_id";
    8384    if ( current_user_can( 'manage_categories' ) ) {
    84         $edit = "<a class='row-title' href='categories.php?action=edit&amp;cat_ID=$category->term_id' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a>";
     85        $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />";
     86        $actions = array();
     87        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
     88        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n  'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
     89        $action_count = count($actions);
     90        $i = 0;
     91        foreach ( $actions as $action => $link ) {
     92            ++$i;
     93            ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
     94            $edit .= "<span class='$action'>$link$sep</span>";
     95        }
    8596    } else {
    8697        $edit = $name;
Note: See TracChangeset for help on using the changeset viewer.