本文整理汇总了PHP中get_delete_post_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_delete_post_link函数的具体用法?PHP get_delete_post_link怎么用?PHP get_delete_post_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_delete_post_link函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: column_title
function column_title($item)
{
$editHref = home_url() . '/wp-admin/post.php?post=' . $item->ID . '&action=edit';
//Build row actions
$actions = array('edit' => '<a href="' . $editHref . '">' . __('Edit') . '</a>', 'delete' => "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($item->ID) . "'>" . __('Trash') . "</a>");
return '<a class="row-title" href="' . home_url() . '/wp-admin/post.php?post=' . $item->ID . '&action=edit">' . $item->post_title . '</a>' . $this->row_actions($actions);
}
开发者ID:uoyknaht,项目名称:kc,代码行数:7,代码来源:film-register-film-list-table.class.php
示例2: addData
/**
* Add additional data to the response object
*/
private function addData()
{
$this->data['delete_link'] = get_delete_post_link($this->data['id'], '', true);
$this->data['nav_status'] = isset($this->data['nav_status']) ? 'hide' : 'show';
$this->data['np_status'] = isset($this->data['nested_pages_status']) ? 'hide' : 'show';
$this->data['link_target'] = isset($this->data['link_target']) ? '_blank' : 'none';
}
开发者ID:raminabsari,项目名称:phonicsschool,代码行数:10,代码来源:NewLinkHandler.php
示例3: column_post_title
public function column_post_title($item)
{
$actions = array('edit' => '<a class="" title="Edit Form" href="' . get_edit_post_link($item->ID) . '">Edit</a>', 'delete' => '<a class="submitdelete" title="Delete Form" href="' . get_delete_post_link($item->ID, '', true) . '">Delete</a>');
$form_title = empty($item->post_title) ? "(no title)" : $item->post_title;
$title = '<strong><a class="row-title" title="Edit Form" href="' . get_edit_post_link($item->ID) . '">' . $form_title . '</a></strong>';
return sprintf('%1$s %2$s', $title, $this->row_actions($actions));
}
开发者ID:donwea,项目名称:nhap.org,代码行数:7,代码来源:class-forms-table.php
示例4: answers_meta_box_content
/**
* Render Meta Box content.
*/
public function answers_meta_box_content()
{
$ans_args = array('post_type' => 'answer', 'post_status' => 'publish', 'post_parent' => get_the_ID(), 'showposts' => 10, 'orderby' => 'date', 'order' => 'DESC');
$ans_args = apply_filters('ap_meta_box_answers_query_args', $ans_args);
$answers = get_posts($ans_args);
if (!empty($answers)) {
foreach ($answers as $ans) {
?>
<div class="answer clearfix">
<div class="author">
<span><?php
echo get_avatar($ans->post_author, 30);
?>
</span>
<strong><?php
echo ap_user_display_name($ans->post_author);
?>
</strong>
</div>
<div class="answer-content">
<div class="submitted-on">
<?php
printf(__('%sAnswered about %s ago%s', 'ap'), '<span class="when">', '</span>', ap_human_time(get_the_time('U', $ans)));
?>
</div>
<p><?php
echo $ans->post_content;
?>
</p>
<div class="row-actions">
<span><a href="<?php
echo get_edit_post_link($ans->ID);
?>
"><?php
_e('Edit', 'ap');
?>
</a></span>
<span> | <a href="#"><?php
_e('Hide', 'ap');
?>
</a></span>
<span class="delete vim-d vim-destructive"> | <a href="<?php
echo get_delete_post_link($ans->ID);
?>
"><?php
_e('Trash', 'ap');
?>
</a></span>
</div>
</div>
</div>
<?php
}
} else {
_e('No answers yet', 'ap');
}
wp_reset_postdata();
}
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:63,代码来源:meta_box.php
示例5: custom_publish_meta_box
function custom_publish_meta_box($post)
{
$slider_id = $post->ID;
$post_status = get_post_status($slider_id);
$delete_link = get_delete_post_link($slider_id);
$nonce = wp_create_nonce('ssp_slider_nonce');
include muneeb_ssp_view_path(__FUNCTION__);
}
开发者ID:katelawroski,项目名称:wordpresssite,代码行数:8,代码来源:ssp_slider_post_type.php
示例6: column_post_title
function column_post_title($post)
{
$actions = array();
if (current_user_can($this->post_type_obj->cap->edit_post, $post)) {
$actions['edit'] = sprintf('<a href="%s">%s</a>', esc_url(get_edit_post_link($post->ID)), esc_html($this->post_type_obj->labels->edit_item));
}
if (current_user_can($this->post_type_obj->cap->delete_post, $post)) {
$actions['delete'] = sprintf('<a href="%s">%s</a>', esc_url(get_delete_post_link($post->ID)), esc_html__('Trash', 'jetpack'));
}
$actions['view'] = sprintf('<a href="%s">%s</a>', esc_url(get_permalink($post->ID)), esc_html($this->post_type_obj->labels->view_item));
return wptexturize($post->post_title) . $this->row_actions($actions);
}
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:12,代码来源:omnisearch-posts.php
示例7: saveRedirect
/**
* Save the item as a redirect post type
*/
private function saveRedirect()
{
$new_link = $this->post_update_repo->saveRedirect($this->data);
if (!$new_link) {
$this->sendErrorResponse();
}
$this->data['post'] = $_POST;
$this->data['post']['id'] = $new_link;
$this->data['post']['content'] = esc_url($_POST['url']);
$this->data['post']['delete_link'] = get_delete_post_link($new_link, '', true);
$this->addExtras($new_link);
$this->response = array('status' => 'success', 'message' => __('Link successfully updated', 'nestedpages'), 'post_data' => $this->data['post']);
}
开发者ID:dtwist,项目名称:wp-nested-pages,代码行数:16,代码来源:NewMenuItem.php
示例8: wc_tab_manager_product_tab_actions_meta_box
/**
* Display the product tab actions meta box.
*
* Displays the product actions meta box - buttons for creating and deleting the tab
*
* @access public
* @param object $post product post object
*/
function wc_tab_manager_product_tab_actions_meta_box($post)
{
?>
<style type="text/css">
#edit-slug-box, #major-publishing-actions, #minor-publishing-actions, #visibility, #submitdiv { display:none }
.wc_product_tab_actions li {
border-bottom: 1px solid #DDDDDD;
border-top: 1px solid #FFFFFF;
line-height: 1.6em;
margin: 0;
padding: 6px 0;
}
.wc_product_tab_actions li:last-child {
border-bottom: 0 none;
}
</style>
<ul class="wc_product_tab_actions">
<li class="wide"><input type="submit" class="button button-primary tips" name="publish" value="<?php
_e('Save Tab', WC_Tab_Manager::TEXT_DOMAIN);
?>
" data-tip="<?php
_e('Save/update the tab', WC_Tab_Manager::TEXT_DOMAIN);
?>
" /></li>
<?php
do_action('woocommerce_tab_manager_product_tab_actions', $post->ID);
?>
<li class="wide">
<?php
if (current_user_can("delete_post", $post->ID)) {
if (!EMPTY_TRASH_DAYS) {
$delete_text = __('Delete Permanently', WC_Tab_Manager::TEXT_DOMAIN);
} else {
$delete_text = __('Move to Trash', WC_Tab_Manager::TEXT_DOMAIN);
}
?>
<a class="submitdelete deletion" href="<?php
echo esc_url(get_delete_post_link($post->ID));
?>
"><?php
echo esc_attr($delete_text);
?>
</a><?php
}
?>
</li>
</ul>
<?php
}
开发者ID:shahadat014,项目名称:geleyi,代码行数:59,代码来源:writepanel-product-tab_actions.php
示例9: ui_get_action_links
/**
* Get action links for this post.
*
* @param string $container_field Ignored.
* @return array of action link HTML.
*/
function ui_get_action_links($container_field = '')
{
$actions = array();
if (current_user_can('edit_post', $this->container_id)) {
$actions['edit'] = '<span class="edit"><a href="' . $this->get_edit_url() . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
if (constant('EMPTY_TRASH_DAYS')) {
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . get_delete_post_link($this->container_id) . "'>" . __('Trash') . "</a>";
} else {
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url(admin_url("post.php?action=delete&post=" . $this->container_id), 'delete-post_' . $this->container_id) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), get_the_title($this->container_id))) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
}
}
$actions['view'] = '<span class="view"><a href="' . get_permalink($this->container_id) . '" title="' . esc_attr(sprintf(__('View "%s"', 'broken-link-checker'), get_the_title($this->container_id))) . '" rel="permalink">' . __('View') . '</a>';
return $actions;
}
开发者ID:slaFFik,项目名称:l10n-ru,代码行数:20,代码来源:post.php
示例10: _icl_trash_restore_prompt
function _icl_trash_restore_prompt()
{
global $sitepress;
if (isset($_GET['lang'])) {
$post = get_post(intval($_GET['post']));
if ($post->post_status == 'trash') {
$post_type_object = get_post_type_object($post->post_type);
$ret = '<p>';
$ret .= sprintf(__('This translation is currently in the trash. You need to either <a href="%s">delete it permanently</a> or <a href="%s">restore</a> it in order to continue.'), get_delete_post_link($post->ID, '', true), wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-' . $post->post_type . '_' . $post->ID));
$ret .= '</p>';
wp_die($ret);
}
}
}
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:14,代码来源:functions.php
示例11: delete_post_link
/**
* Display edit post link for post.
*
* @since 1.0.0
*
* @param string $link Optional. Anchor text.
* @param string $before Optional. Display before edit link.
* @param string $after Optional. Display after edit link.
* @param int $id Optional. Post ID.
*/
function delete_post_link($link = null, $before = '', $after = '', $id = 0)
{
if (!($post = get_post($id))) {
return;
}
if (!($url = get_delete_post_link($post->ID))) {
return;
}
if (null === $link) {
$link = __('Delete This', 'pronamic_framework');
}
$post_type_obj = get_post_type_object($post->post_type);
$link = '<a class="post-delete-link" href="' . $url . '">' . $link . '</a>';
echo $before . apply_filters('delete_post_link', $link, $post->ID) . $after;
}
开发者ID:joffcrabtree,项目名称:wp-pronamic-framework,代码行数:25,代码来源:link-template.php
示例12: answer_row_actions
/**
* Add action links below question/answer content in wp post list.
* @param string $column Current column name.
* @param integer $post_id Current post id.
*/
public function answer_row_actions($column, $post_id)
{
global $post, $mode;
if ('answer_content' != $column) {
return;
}
$question = get_post($post->post_parent);
echo '<a href="' . get_permalink($post->post_parent) . '" class="row-title">' . $question->post_title . '</a>';
$content = get_the_excerpt();
// Get the first 80 words from the content and added to the $abstract variable.
preg_match('/^([^.!?\\s]*[\\.!?\\s]+){0,40}/', strip_tags($content), $abstract);
// Pregmatch will return an array and the first 80 chars will be in the first element
echo $abstract[0] . '...';
// First set up some variables
$actions = array();
$post_type_object = get_post_type_object($post->post_type);
$can_edit_post = current_user_can($post_type_object->cap->edit_post, $post->ID);
// Actions to delete/trash.
if (current_user_can($post_type_object->cap->delete_post, $post->ID)) {
if ('trash' == $post->post_status) {
$_wpnonce = wp_create_nonce('untrash-post_' . $post_id);
$url = admin_url('post.php?post=' . $post_id . '&action=untrash&_wpnonce=' . $_wpnonce);
$actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash', 'anspress-question-answer')) . "' href='" . $url . "'>" . __('Restore', 'anspress-question-answer') . '</a>';
} elseif (EMPTY_TRASH_DAYS) {
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash', 'anspress-question-answer')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash', 'anspress-question-answer') . '</a>';
}
if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently', 'anspress-question-answer')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently', 'anspress-question-answer') . '</a>';
}
}
if ($can_edit_post) {
$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, '', true) . '" title="' . esc_attr(sprintf(__('Edit “%s”', 'anspress-question-answer'), $post->title)) . '" rel="permalink">' . __('Edit', 'anspress-question-answer') . '</a>';
}
// Actions to view/preview.
if (in_array($post->post_status, array('pending', 'draft', 'future')) && $can_edit_post) {
$actions['view'] = '<a href="' . esc_url(add_query_arg('preview', 'true', get_permalink($post->ID))) . '" title="' . esc_attr(sprintf(__('Preview “%s”', 'anspress-question-answer'), $post->title)) . '" rel="permalink">' . __('Preview', 'anspress-question-answer') . '</a>';
} elseif ('trash' != $post->post_status) {
$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(__('View “%s” question', 'anspress-question-answer')) . '" rel="permalink">' . __('View', 'anspress-question-answer') . '</a>';
}
if (ap_flagged_post_meta($post->ID)) {
$actions['flag'] = '<a href="#" data-query="ap_clear_flag::' . wp_create_nonce('clear_flag_' . $post->ID) . '::' . $post->ID . '" class="ap-ajax-btn flag-clear" data-cb="afterFlagClear">' . __('Clear flag', 'anspress-question-answer') . '</a>';
}
// Echo the 'actions' HTML, let WP_List_Table do the hard work.
$WP_List_Table = new WP_List_Table();
echo $WP_List_Table->row_actions($actions);
}
开发者ID:erashu212,项目名称:anspress,代码行数:51,代码来源:class-list-table-hooks.php
示例13: job_application_save
/**
* Publish meta box
*/
public function job_application_save($post)
{
$statuses = get_job_application_statuses();
?>
<div class="submitbox" id="submitpost">
<div id="minor-publishing">
<div id="misc-publishing-actions">
<div class="misc-pub-section misc-pub-post-status">
<div id="post-status-select">
<select name='post_status' id='post_status'>
<?php
foreach ($statuses as $key => $label) {
$selected = selected($post->post_status, $key, false);
echo "<option{$selected} value='" . esc_attr($key) . "'>" . esc_html($label) . "</option>";
}
?>
</select>
</div>
</div>
</div>
</div>
<div id="major-publishing-actions">
<div id="delete-action">
<a class="submitdelete deletion" href="<?php
echo get_delete_post_link($post->ID);
?>
"><?php
_e('Move to Trash');
?>
</a>
</div>
<div id="publishing-action">
<span class="spinner"></span>
<input name="save" class="button button-primary" type="submit" value="<?php
_e('Save', 'wp-job-manager-applications');
?>
">
</div>
<div class="clear"></div>
</div>
</div>
<?php
}
开发者ID:vinodhip,项目名称:Function-22-Website,代码行数:46,代码来源:class-wp-job-manager-applications-writepanels.php
示例14: get_actions
/**
* @see CPAC_Column_Actions::get_actions()
* @since 2.2.6
*/
public function get_actions($item_id)
{
$actions = array();
$post = get_post($item_id);
$title = _draft_or_post_title();
$post_type_object = get_post_type_object($post->post_type);
$can_edit_post = current_user_can($post_type_object->cap->edit_post, $post->ID);
$quickedit_enabled = false;
$stored_columns = $this->get_storage_model()->get_stored_columns();
foreach ($stored_columns as $column) {
if ($column['type'] == 'title') {
$quickedit_enabled = true;
}
}
// taken from Wordpress core
if ($can_edit_post && 'trash' != $post->post_status) {
$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>';
if ($quickedit_enabled) {
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick Edit') . '</a>';
}
}
if (current_user_can($post_type_object->cap->delete_post, $post->ID)) {
if ('trash' == $post->post_status) {
$actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
} elseif (EMPTY_TRASH_DAYS) {
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>";
}
if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</a>";
}
}
if ($post_type_object->public) {
if (in_array($post->post_status, array('pending', 'draft', 'future'))) {
if ($can_edit_post) {
$actions['view'] = '<a href="' . esc_url(add_query_arg('preview', 'true', get_permalink($post->ID))) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
}
} elseif ('trash' != $post->post_status) {
$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>';
}
}
return $actions;
}
开发者ID:xeiter,项目名称:timeplannr,代码行数:46,代码来源:actions.php
示例15: annowf_major_action_draft_markup
/**
* Draft state markup for major actions.
*/
function annowf_major_action_draft_markup()
{
global $anno_post_save;
$post_id = anno_get_post_id();
if (anno_user_can('trash_post')) {
$wrap_class = '';
?>
<div id="delete-action">
<a class="submitdelete deletion" href="<?php
echo get_delete_post_link($post_id);
?>
"><?php
_ex('Move To Trash', 'Publishing box trash action link text', 'anno');
?>
</a>
</div>
<?php
} else {
$wrap_class = ' class="center-wrap"';
}
?>
<div id="publishing-action"<?php
echo $wrap_class;
?>
>
<img src="<?php
echo esc_url(admin_url('images/wpspin_light.gif'));
?>
" class="ajax-loading" id="ajax-loading" alt="" />
<input name="original_publish" type="hidden" id="original_publish" value="<?php
esc_attr_e($anno_post_save['review']);
?>
" />
<?php
submit_button($anno_post_save['review'], 'primary', 'publish', false, array('tabindex' => '5', 'accesskey' => 'p'));
?>
</div>
<div class="clear"></div>
<?php
}
开发者ID:nameofname,项目名称:momo-wordpress-theme,代码行数:44,代码来源:publishing-meta-box.php
示例16: o2_get_default_post_actions
function o2_get_default_post_actions($actions = false, $post_ID = false)
{
if (false === $actions) {
$actions = array();
}
// Reply
$logged_in_requirement_satisfied = get_option('comment_registration') ? is_user_logged_in() : true;
if (comments_open($post_ID) && !post_password_required($post_ID) && $logged_in_requirement_satisfied) {
$actions[20] = array('action' => 'reply', 'href' => get_permalink($post_ID) . '#respond', 'classes' => array('o2-post-reply', 'o2-reply'), 'rel' => false, 'initialState' => 'default');
}
// Scroll to Comments (Mobile)
$actions[25] = array('action' => 'scrolltocomments', 'href' => get_permalink($post_ID), 'classes' => array('o2-scroll-to-comments'), 'rel' => false, 'initialState' => 'default');
// Edit
if (current_user_can('edit_post', $post_ID)) {
$actions[30] = array('action' => 'edit', 'href' => get_edit_post_link($post_ID), 'classes' => array('edit-post-link', 'o2-edit'), 'rel' => $post_ID, 'initialState' => 'default');
}
// Trash
if (current_user_can('edit_post', $post_ID)) {
$actions[100] = array('action' => 'trash', 'href' => get_delete_post_link($post_ID), 'classes' => array('trash-post-link', 'o2-trash', 'o2-actions-border-top', 'o2-warning-hover'), 'rel' => $post_ID, 'initialState' => 'default');
}
// Shortlink
$actions[40] = array('action' => 'shortlink', 'href' => wp_get_shortlink($post_ID, 'post'), 'classes' => array('short-link', 'o2-short-link'), 'rel' => false, 'initialState' => 'default');
return $actions;
}
开发者ID:BE-Webdesign,项目名称:o2,代码行数:24,代码来源:template-tags.php
示例17: cx_visitors_cols_content
/**
* Custom columns content of visitors
*
* @access public
* @return void
*/
function cx_visitors_cols_content($col, $post_ID)
{
switch ($col) {
case '_title':
echo '<strong><a class="row-title" href="' . get_permalink() . '">' . get_the_title() . '</a></strong>';
echo "<div class='row-actions'><span class='trash'><a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post_ID, '', true) . "'>" . __('Delete Permanently', 'cx') . "</a></span></div>";
break;
case 'email':
$email = get_post_meta($post_ID, 'Email', 1);
echo '<a href="mailto:' . $email . '">' . $email . '</a>';
break;
case 'phone':
echo get_post_meta($post_ID, 'Phone', 1);
break;
case 'details':
echo get_post_meta($post_ID, 'OS', 1) . ', ';
echo get_post_meta($post_ID, 'Browser', 1) . '<br>';
echo '<strong>IP:</strong> ' . get_post_meta($post_ID, 'IP Address', 1);
break;
case 'last_login':
echo get_the_modified_date() . ' ' . get_the_modified_time();
break;
}
}
开发者ID:baden03,项目名称:access48,代码行数:30,代码来源:fn.admin.php
示例18: handle_row_actions
/**
* Generates and displays row action links.
*
* @since 4.3.0
* @access protected
*
* @param object $post Post being acted upon.
* @param string $column_name Current column name.
* @param string $primary Primary column name.
* @return string Row actions output for posts.
*/
protected function handle_row_actions($post, $column_name, $primary)
{
if ($primary !== $column_name) {
return '';
}
$post_type_object = get_post_type_object($post->post_type);
$can_edit_post = current_user_can('edit_post', $post->ID);
$actions = array();
$title = _draft_or_post_title();
if ($can_edit_post && 'trash' != $post->post_status) {
$actions['edit'] = sprintf('<a href="%s" aria-label="%s">%s</a>', get_edit_post_link($post->ID), esc_attr(sprintf(__('Edit “%s”'), $title)), __('Edit'));
$actions['inline hide-if-no-js'] = sprintf('<a href="#" class="editinline" aria-label="%s">%s</a>', esc_attr(sprintf(__('Quick edit “%s” inline'), $title)), __('Quick Edit'));
}
if (current_user_can('delete_post', $post->ID)) {
if ('trash' === $post->post_status) {
$actions['untrash'] = sprintf('<a href="%s" aria-label="%s">%s</a>', wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID), esc_attr(sprintf(__('Restore “%s” from the Trash'), $title)), __('Restore'));
} elseif (EMPTY_TRASH_DAYS) {
$actions['trash'] = sprintf('<a href="%s" class="submitdelete" aria-label="%s">%s</a>', get_delete_post_link($post->ID), esc_attr(sprintf(__('Move “%s” to the Trash'), $title)), _x('Trash', 'verb'));
}
if ('trash' === $post->post_status || !EMPTY_TRASH_DAYS) {
$actions['delete'] = sprintf('<a href="%s" class="submitdelete" aria-label="%s">%s</a>', get_delete_post_link($post->ID, '', true), esc_attr(sprintf(__('Delete “%s” permanently'), $title)), __('Delete Permanently'));
}
}
if (is_post_type_viewable($post_type_object)) {
if (in_array($post->post_status, array('pending', 'draft', 'future'))) {
if ($can_edit_post) {
$unpublished_link = set_url_scheme(get_permalink($post));
$preview_link = get_preview_post_link($post, array(), $unpublished_link);
$actions['view'] = sprintf('<a href="%s" rel="permalink" aria-label="%s">%s</a>', esc_url($preview_link), esc_attr(sprintf(__('Preview “%s”'), $title)), __('Preview'));
}
} elseif ('trash' != $post->post_status) {
$actions['view'] = sprintf('<a href="%s" rel="permalink" aria-label="%s">%s</a>', get_permalink($post->ID), esc_attr(sprintf(__('View “%s”'), $title)), __('View'));
}
}
if (is_post_type_hierarchical($post->post_type)) {
/**
* Filter the array of row action links on the Pages list table.
*
* The filter is evaluated only for hierarchical post types.
*
* @since 2.8.0
*
* @param array $actions An array of row action links. Defaults are
* 'Edit', 'Quick Edit', 'Restore, 'Trash',
* 'Delete Permanently', 'Preview', and 'View'.
* @param WP_Post $post The post object.
*/
$actions = apply_filters('page_row_actions', $actions, $post);
} else {
/**
* Filter the array of row action links on the Posts list table.
*
* The filter is evaluated only for non-hierarchical post types.
*
* @since 2.8.0
*
* @param array $actions An array of row action links. Defaults are
* 'Edit', 'Quick Edit', 'Restore, 'Trash',
* 'Delete Permanently', 'Preview', and 'View'.
* @param WP_Post $post The post object.
*/
$actions = apply_filters('post_row_actions', $actions, $post);
}
return $this->row_actions($actions);
}
开发者ID:dd32,项目名称:wordpress.develop,代码行数:76,代码来源:class-wp-posts-list-table.php
示例19: column_title
/**
* Return title column
* @param object $webhook
* @return string
*/
public function column_title($webhook)
{
$the_webhook = $this->get_webbook_object($webhook);
$edit_link = admin_url('admin.php?page=wc-settings&tab=api&section=webhooks&edit-webhook=' . $the_webhook->id);
$title = _draft_or_post_title($the_webhook->get_post_data());
$post_type_object = get_post_type_object($the_webhook->get_post_data()->post_type);
$post_status = $the_webhook->get_post_data()->post_status;
// Title
$output = '<strong>';
if ('trash' == $post_status) {
$output .= esc_html($title);
} else {
$output .= '<a href="' . esc_url($edit_link) . '" class="row-title">' . esc_html($title) . '</a>';
}
$output .= '</strong>';
// Get actions
$actions = array('id' => sprintf(__('ID: %d', 'woocommerce'), $the_webhook->id));
if (current_user_can($post_type_object->cap->edit_post, $the_webhook->id) && 'trash' !== $post_status) {
$actions['edit'] = '<a href="' . esc_url($edit_link) . '">' . __('Edit', 'woocommerce') . '</a>';
}
if (current_user_can($post_type_object->cap->delete_post, $the_webhook->id)) {
if ('trash' == $post_status) {
$actions['untrash'] = '<a title="' . esc_attr__('Restore this item from the Trash', 'woocommerce') . '" href="' . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $the_webhook->id)), 'untrash-post_' . $the_webhook->id) . '">' . __('Restore', 'woocommerce') . '</a>';
} elseif (EMPTY_TRASH_DAYS) {
$actions['trash'] = '<a class="submitdelete" title="' . esc_attr(__('Move this item to the Trash', 'woocommerce')) . '" href="' . get_delete_post_link($the_webhook->id) . '">' . __('Trash', 'woocommerce') . '</a>';
}
if ('trash' == $post_status || !EMPTY_TRASH_DAYS) {
$actions['delete'] = '<a class="submitdelete" title="' . esc_attr(__('Delete this item permanently', 'woocommerce')) . '" href="' . get_delete_post_link($the_webhook->id, '', true) . '">' . __('Delete Permanently', 'woocommerce') . '</a>';
}
}
$actions = apply_filters('post_row_actions', $actions, $the_webhook->get_post_data());
$row_actions = array();
foreach ($actions as $action => $link) {
$row_actions[] = '<span class="' . esc_attr($action) . '">' . $link . '</span>';
}
$output .= '<div class="row-actions">' . implode(' | ', $row_actions) . '</div>';
return $output;
}
开发者ID:CannedHead,项目名称:feelingsurf,代码行数:43,代码来源:class-wc-admin-webhooks-table-list.php
示例20: woocommerce_custom_product_columns
/**
* Custom Columns for Products page
*
* @access public
* @param mixed $column
* @return void
*/
function woocommerce_custom_product_columns($column)
{
global $post, $woocommerce, $the_product;
if (empty($the_product) || $the_product->id != $post->ID) {
$the_product = get_product($post);
}
switch ($column) {
case "thumb":
echo '<a href="' . get_edit_post_link($post->ID) . '">' . $the_product->get_image() . '</a>';
break;
case "name":
$edit_link = get_edit_post_link($post->ID);
$title = _draft_or_post_title();
$post_type_object = get_post_type_object($post->post_type);
$can_edit_post = current_user_can($post_type_object->cap->edit_post, $post->ID);
echo '<strong><a class="row-title" href="' . $edit_link . '">' . $title . '</a>';
_post_states($post);
echo '</strong>';
if ($post->post_parent > 0) {
echo ' ← <a href="' . get_edit_post_link($post->post_parent) . '">' . get_the_title($post->post_parent) . '</a>';
}
// Excerpt view
if (isset($_GET['mode']) && $_GET['mode'] == 'excerpt') {
echo apply_filters('the_excerpt', $post->post_excerpt);
}
// Get actions
$actions = array();
$actions['id'] = 'ID: ' . $post->ID;
if ($can_edit_post && 'trash' != $post->post_status) {
$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick Edit') . '</a>';
}
if (current_user_can($post_type_object->cap->delete_post, $post->ID)) {
if ('trash' == $post->post_status) {
$actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
} elseif (EMPTY_TRASH_DAYS) {
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>";
}
if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</a>";
}
}
if ($post_type_object->public) {
if (in_array($post->post_status, array('pending', 'draft', 'future'))) {
if ($can_edit_post) {
$actions['view'] = '<a href="' . esc_url(add_query_arg('preview', 'true', get_permalink($post->ID))) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
}
} elseif ('trash' != $post->post_status) {
$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>';
}
}
$actions = apply_filters('post_row_actions', $actions, $post);
echo '<div class="row-actions">';
$i = 0;
$action_count = sizeof($actions);
foreach ($actions as $action => $link) {
|
请发表评论