当前位置: 首页>>代码示例>>PHP>>正文


PHP _draft_or_post_title函数代码示例

本文整理汇总了PHP中_draft_or_post_title函数的典型用法代码示例。如果您正苦于以下问题:PHP _draft_or_post_title函数的具体用法?PHP _draft_or_post_title怎么用?PHP _draft_or_post_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_draft_or_post_title函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: jl_brd_dashboard_recent_drafts

function jl_brd_dashboard_recent_drafts($drafts = false)
{
    if (!$drafts) {
        $drafts_query = new WP_Query(array('post_type' => 'any', 'post_status' => array('draft', 'pending'), 'posts_per_page' => 150, 'orderby' => 'modified', 'order' => 'DESC'));
        $drafts =& $drafts_query->posts;
    }
    if ($drafts && is_array($drafts)) {
        $list = array();
        foreach ($drafts as $draft) {
            $url = get_edit_post_link($draft->ID);
            $title = _draft_or_post_title($draft->ID);
            $last_id = get_post_meta($draft->ID, '_edit_last', true);
            $last_user = get_userdata($last_id);
            $last_modified = '<i>' . esc_html($last_user->display_name) . '</i>';
            $item = '<h4><a href="' . $url . '" title="' . sprintf(__('Edit ?%s?'), esc_attr($title)) . '">' . esc_html($title) . '</a>' . '<abbr> ' . $draft->post_status . ' ' . $draft->post_type . '</abbr>' . '<abbr style="display:block;margin-left:0;">' . sprintf(__('Last edited by %1$s on %2$s at %3$s'), $last_modified, mysql2date(get_option('date_format'), $draft->post_modified), mysql2date(get_option('time_format'), $draft->post_modified)) . '</abbr></h4>';
            if ($the_content = preg_split('#\\s#', strip_shortcodes(strip_tags($draft->post_content), 11, PREG_SPLIT_NO_EMPTY))) {
                $item .= '<p>' . join(' ', array_slice($the_content, 0, 10)) . (10 < count($the_content) ? '&hellip;' : '') . '</p>';
            }
            $list[] = $item;
        }
        ?>
	<ul>
		<li><?php 
        echo join("</li>\n<li>", $list);
        ?>
</li>
	</ul>
<?php 
    } else {
        _e('There are no drafts at the moment');
    }
}
开发者ID:aarontgrogg,项目名称:aarontgrogg,代码行数:32,代码来源:better-recent-drafts.php

示例2: get_actions

 /**
  * @see CPAC_Column_Actions::get_actions()
  * @since 2.3.4
  */
 public function get_actions($id)
 {
     global $wp_list_table;
     if (!$wp_list_table) {
         return;
     }
     $post = get_post($id);
     $att_title = _draft_or_post_title($id);
     $actions = array();
     if ($wp_list_table->detached) {
         if (current_user_can('edit_post', $post->ID)) {
             $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
         }
         if (current_user_can('delete_post', $post->ID)) {
             if (EMPTY_TRASH_DAYS && MEDIA_TRASH) {
                 $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post={$post->ID}", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
             } else {
                 $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
                 $actions['delete'] = "<a class='submitdelete'{$delete_ays} href='" . wp_nonce_url("post.php?action=delete&amp;post={$post->ID}", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
             }
         }
         $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $att_title)) . '" rel="permalink">' . __('View') . '</a>';
         if (current_user_can('edit_post', $post->ID)) {
             $actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\'' . $post->ID . '\' );return false;" class="hide-if-no-js">' . __('Attach') . '</a>';
         }
     } else {
         if (current_user_can('edit_post', $post->ID) && !$wp_list_table->is_trash) {
             $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
         }
         if (current_user_can('delete_post', $post->ID)) {
             if ($wp_list_table->is_trash) {
                 $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=untrash&amp;post={$post->ID}", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
             } elseif (EMPTY_TRASH_DAYS && MEDIA_TRASH) {
                 $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post={$post->ID}", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
             }
             if ($wp_list_table->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH) {
                 $delete_ays = !$wp_list_table->is_trash && !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
                 $actions['delete'] = "<a class='submitdelete'{$delete_ays} href='" . wp_nonce_url("post.php?action=delete&amp;post={$post->ID}", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
             }
         }
         if (!$wp_list_table->is_trash) {
             $title = _draft_or_post_title($post->post_parent);
             $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
         }
     }
     /**
      * Filter the action links for each attachment in the Media list table.
      *
      * @since 2.8.0
      *
      * @param array   $actions  An array of action links for each attachment.
      *                          Default 'Edit', 'Delete Permanently', 'View'.
      * @param WP_Post $post     WP_Post object for the current attachment.
      * @param bool    $detached Whether the list table contains media not attached
      *                          to any posts. Default true.
      */
     $actions = apply_filters('media_row_actions', $actions, $post, $wp_list_table->detached);
     return $actions;
 }
开发者ID:xeiter,项目名称:timeplannr,代码行数:63,代码来源:actions.php

示例3: get_column_value_actions

 /**
  * Get column value of media actions
  *
  * This part is copied from the Media List Table class
  *
  * @since 1.4.2
  *
  * @param int $id
  * @return string Actions
  */
 private function get_column_value_actions($id)
 {
     if (file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php')) {
         require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
     }
     if (file_exists(ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php')) {
         require_once ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php';
     }
     // we need class to get the object actions
     $m = new WP_Media_List_Table();
     // prevent php notice
     $m->is_trash = isset($_REQUEST['status']) && 'trash' == $_REQUEST['status'];
     // get media actions
     $media = get_post($id);
     $actions = $m->_get_row_actions($media, _draft_or_post_title($id));
     return implode(' | ', $actions);
 }
开发者ID:GaryJones,项目名称:m2xdemo,代码行数:27,代码来源:actions.php

示例4: media_custom_columns

function media_custom_columns($column_name, $id)
{
    $post = get_post($id);
    if ($column_name != 'better_parent') {
        return;
    }
    if ($post->post_parent > 0) {
        if (get_post($post->post_parent)) {
            $title = _draft_or_post_title($post->post_parent);
        }
        ?>
	            <strong><a href="<?php 
        echo get_edit_post_link($post->post_parent);
        ?>
"><?php 
        echo $title;
        ?>
</a></strong>, <?php 
        echo get_the_time(__('Y/m/d'));
        ?>
	            <br />
	            <a class="hide-if-no-js" onclick="findPosts.open('media[]','<?php 
        echo $post->ID;
        ?>
');return false;" href="#the-list"><?php 
        _e('Re-Attach');
        ?>
</a>
	            <?php 
    } else {
        ?>
	            <?php 
        _e('(Unattached)');
        ?>
<br />
	            <a class="hide-if-no-js" onclick="findPosts.open('media[]','<?php 
        echo $post->ID;
        ?>
');return false;" href="#the-list"><?php 
        _e('Attach');
        ?>
</a>
	            <?php 
    }
}
开发者ID:ashleycam3ron,项目名称:functions,代码行数:45,代码来源:media_library.php

示例5: anno_wp_dashboard_recent_post_types

function anno_wp_dashboard_recent_post_types($args)
{
    /* Chenged from here */
    if (!$args['post_type']) {
        $args['post_type'] = 'any';
    }
    $query_args = array('post_type' => $args['post_type'], 'post_status' => $args['status'], 'orderby' => 'date', 'order' => $args['order'], 'posts_per_page' => intval($args['max']), 'no_found_rows' => true, 'cache_results' => false);
    $posts = new WP_Query($query_args);
    if ($posts->have_posts()) {
        echo '<div id="' . $args['id'] . '" class="activity-block">';
        echo '<h4>' . $args['title'] . '</h4>';
        echo '<ul>';
        $i = 0;
        $today = date('Y-m-d', current_time('timestamp'));
        $tomorrow = date('Y-m-d', strtotime('+1 day', current_time('timestamp')));
        while ($posts->have_posts()) {
            $posts->the_post();
            $time = get_the_time('U');
            if (date('Y-m-d', $time) == $today) {
                $relative = __('Today', 'annot');
            } elseif (date('Y-m-d', $time) == $tomorrow) {
                $relative = __('Tomorrow', 'anno');
            } else {
                /* translators: date and time format for recent posts on the dashboard, see http://php.net/date */
                $relative = date_i18n(__('M jS', 'anno'), $time);
            }
            $text = sprintf(_x('<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>', '1: relative date, 2: time, 4: post title', 'anno'), $relative, get_the_time(), get_edit_post_link(), _draft_or_post_title());
            $hidden = $i >= $args['display'] ? ' class="hidden"' : '';
            echo "<li{$hidden}>{$text}</li>";
            $i++;
        }
        echo '</ul>';
        echo '</div>';
    } else {
        return false;
    }
    wp_reset_postdata();
    return true;
}
开发者ID:dregula,项目名称:Annotum,代码行数:39,代码来源:anno-admin-activity-widget.php

示例6: 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&amp;tab=api&amp;section=webhooks&amp;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 . '&amp;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

示例7: xt_manage_post_custom_column

function xt_manage_post_custom_column($column, $post_id)
{
    switch ($column) {
        case 'icon':
            $att_title = _draft_or_post_title();
            ?>
				<a href="<?php 
            echo esc_url(get_edit_post_link($post_id, true));
            ?>
" title="<?php 
            echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;', XT_TEXT_DOMAIN), $att_title));
            ?>
"><?php 
            if ($thumb = get_the_post_thumbnail($post_id, array(80, 60))) {
                echo $thumb;
            } else {
                echo '<img width="46" height="60" src="' . wp_mime_type_icon('image/jpeg') . '" alt="">';
            }
            ?>
</a>
<?php 
            break;
    }
}
开发者ID:venturepact,项目名称:blog,代码行数:24,代码来源:setup-news.php

示例8: 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();
     if ($can_edit_post && 'trash' != $post->post_status) {
         $actions['edit'] = '<a href="' . get_edit_post_link($post->ID) . '" 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&nbsp;Edit') . '</a>';
     }
     if (current_user_can('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 . '&amp;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 (is_post_type_viewable($post_type_object)) {
         $title = _draft_or_post_title();
         if (in_array($post->post_status, array('pending', 'draft', 'future'))) {
             if ($can_edit_post) {
                 $preview_link = set_url_scheme(get_permalink($post->ID));
                 /** This filter is documented in wp-admin/includes/meta-boxes.php */
                 $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
                 $actions['view'] = '<a href="' . esc_url($preview_link) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
             }
         } elseif ('trash' != $post->post_status) {
             $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
         }
     }
     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:rlgod,项目名称:WordPress,代码行数:77,代码来源:class-wp-posts-list-table.php

示例9: custom_hubpage_columns

 function custom_hubpage_columns($column)
 {
     global $post;
     switch ($column) {
         case "hub_title":
             $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 '&nbsp;&nbsp;&larr; <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['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>';
             if ($can_edit_post && 'trash' != $post->post_status) {
                 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline', WPC_CLIENT_TEXT_DOMAIN)) . '">' . __('Quick&nbsp;Edit', WPC_CLIENT_TEXT_DOMAIN) . '</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', WPC_CLIENT_TEXT_DOMAIN)) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&amp;action=untrash', $post->ID)), 'untrash-' . $post->post_type . '_' . $post->ID) . "'>" . __('Restore', WPC_CLIENT_TEXT_DOMAIN) . "</a>";
                 } elseif (EMPTY_TRASH_DAYS) {
                     $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash', WPC_CLIENT_TEXT_DOMAIN)) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash', WPC_CLIENT_TEXT_DOMAIN) . "</a>";
                 }
                 if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
                     $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently', WPC_CLIENT_TEXT_DOMAIN)) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently', WPC_CLIENT_TEXT_DOMAIN) . "</a>";
                 }
             }
             if ($post_type_object->public) {
                 if ('trash' != $post->post_status) {
                     $actions['view'] = '<a href="' . wpc_client_get_slug('hub_page_id') . $post->ID . '" target="_blank" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;', WPC_CLIENT_TEXT_DOMAIN), $title)) . '" rel="permalink">' . __('Preview', WPC_CLIENT_TEXT_DOMAIN) . '</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 "client":
             $client = get_users(array('role' => 'wpc_client', 'meta_key' => 'wpc_cl_hubpage_id', 'meta_value' => $post->ID));
             if ($client) {
                 echo $client[0]->user_login;
             }
             break;
     }
 }
开发者ID:joffcrabtree,项目名称:wp-client-client-portals-file-upload-invoices-billing,代码行数:60,代码来源:wp-client-lite.php

示例10: wp_dashboard_recent_posts

/**
 * Generates Publishing Soon and Recently Published sections.
 *
 * @since 3.8.0
 *
 * @param array $args {
 *     An array of query and display arguments.
 *
 *     @type int    $max     Number of posts to display.
 *     @type string $status  Post status.
 *     @type string $order   Designates ascending ('ASC') or descending ('DESC') order.
 *     @type string $title   Section title.
 *     @type string $id      The container id.
 * }
 * @return bool False if no posts were found. True otherwise.
 */
function wp_dashboard_recent_posts($args)
{
    $query_args = array('post_type' => 'post', 'post_status' => $args['status'], 'orderby' => 'date', 'order' => $args['order'], 'posts_per_page' => intval($args['max']), 'no_found_rows' => true, 'cache_results' => false, 'perm' => 'future' === $args['status'] ? 'editable' : 'readable');
    /**
     * Filter the query arguments used for the Recent Posts widget.
     *
     * @since 4.2.0
     *
     * @param array $query_args The arguments passed to WP_Query to produce the list of posts.
     */
    $query_args = apply_filters('dashboard_recent_posts_query_args', $query_args);
    $posts = new WP_Query($query_args);
    if ($posts->have_posts()) {
        echo '<div id="' . $args['id'] . '" class="activity-block">';
        echo '<h4>' . $args['title'] . '</h4>';
        echo '<ul>';
        $today = date('Y-m-d', current_time('timestamp'));
        $tomorrow = date('Y-m-d', strtotime('+1 day', current_time('timestamp')));
        while ($posts->have_posts()) {
            $posts->the_post();
            $time = get_the_time('U');
            if (date('Y-m-d', $time) == $today) {
                $relative = __('Today');
            } elseif (date('Y-m-d', $time) == $tomorrow) {
                $relative = __('Tomorrow');
            } else {
                /* translators: date and time format for recent posts on the dashboard, see http://php.net/date */
                $relative = date_i18n(__('M jS'), $time);
            }
            // Use the post edit link for those who can edit, the permalink otherwise.
            $recent_post_link = current_user_can('edit_post', get_the_ID()) ? get_edit_post_link() : get_permalink();
            /* translators: 1: relative date, 2: time, 3: post edit link or permalink, 4: post title */
            $format = __('<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>');
            printf("<li>{$format}</li>", $relative, get_the_time(), $recent_post_link, _draft_or_post_title());
        }
        echo '</ul>';
        echo '</div>';
    } else {
        return false;
    }
    wp_reset_postdata();
    return true;
}
开发者ID:riasnelli,项目名称:WordPress,代码行数:59,代码来源:dashboard.php

示例11: wp_dashboard_recent_drafts

function wp_dashboard_recent_drafts($drafts = false)
{
    if (!$drafts) {
        $drafts_query = new WP_Query(array('post_type' => 'post', 'post_status' => 'draft', 'author' => $GLOBALS['current_user']->ID, 'posts_per_page' => 5, 'orderby' => 'modified', 'order' => 'DESC'));
        $drafts =& $drafts_query->posts;
    }
    if ($drafts && is_array($drafts)) {
        $list = array();
        foreach ($drafts as $draft) {
            $url = get_edit_post_link($draft->ID);
            $title = _draft_or_post_title($draft->ID);
            $item = "<h4><a href='{$url}' title='" . sprintf(__('Edit &#8220;%s&#8221;'), esc_attr($title)) . "'>" . esc_html($title) . "</a> <abbr title='" . get_the_time(__('Y/m/d g:i:s A'), $draft) . "'>" . get_the_time(get_option('date_format'), $draft) . '</abbr></h4>';
            if ($the_content = preg_split('#\\s#', strip_tags($draft->post_content), 11, PREG_SPLIT_NO_EMPTY)) {
                $item .= '<p>' . join(' ', array_slice($the_content, 0, 10)) . (10 < count($the_content) ? '&hellip;' : '') . '</p>';
            }
            $list[] = $item;
        }
        ?>
	<ul>
		<li><?php 
        echo join("</li>\n<li>", $list);
        ?>
</li>
	</ul>
	<p class="textright"><a href="edit.php?post_status=draft" ><?php 
        _e('View all');
        ?>
</a></p>
<?php 
    } else {
        _e('There are no drafts at the moment');
    }
}
开发者ID:nouphet,项目名称:rata,代码行数:33,代码来源:dashboard.php

示例12: get_edit_post_link

    default:
        if (!($revision = wp_get_post_revision($revision_id))) {
            break;
        }
        if (!($post = get_post($revision->post_parent))) {
            break;
        }
        if (!current_user_can('read_post', $revision->ID) || !current_user_can('read_post', $post->ID)) {
            break;
        }
        // Revisions disabled and we're not looking at an autosave
        if (!wp_revisions_enabled($post) && !wp_is_post_autosave($revision)) {
            $redirect = 'edit.php?post_type=' . $post->post_type;
            break;
        }
        $post_title = '<a href="' . get_edit_post_link() . '">' . _draft_or_post_title() . '</a>';
        $h2 = sprintf(__('Compare Revisions of &#8220;%1$s&#8221;'), $post_title);
        $title = __('Revisions');
        $redirect = false;
        break;
}
// Empty post_type means either malformed object found, or no valid parent was found.
if (!$redirect && empty($post->post_type)) {
    $redirect = 'edit.php';
}
if (!empty($redirect)) {
    wp_redirect($redirect);
    exit;
}
// This is so that the correct "Edit" menu item is selected.
if (!empty($post->post_type) && 'post' != $post->post_type) {
开发者ID:palimadra,项目名称:bubblegraphics-wpsite,代码行数:31,代码来源:revision.php

示例13: _x

    ?>
</th>
	<th scope="col"><?php 
    /* translators: column name in media */
    echo _x('Date Added', 'media column name');
    ?>
</th>
</tr>
</tfoot>

<tbody id="the-list" class="list:post">
<?php 
    if ($orphans) {
        foreach ($orphans as $post) {
            $class = 'alternate' == $class ? '' : 'alternate';
            $att_title = esc_html(_draft_or_post_title($post->ID));
            ?>
	<tr id='post-<?php 
            echo $post->ID;
            ?>
' class='<?php 
            echo $class;
            ?>
' valign="top">
		<th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php 
            echo esc_attr($post->ID);
            ?>
" /></th>

		<td class="media-icon"><?php 
            if ($thumb = wp_get_attachment_image($post->ID, array(80, 60), true)) {
开发者ID:papayalabs,项目名称:htdocs,代码行数:31,代码来源:upload.php

示例14: render_social_icon_columns

 /**
  * Output custom columns for icons.
  * @param string $column
  */
 public function render_social_icon_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_social_icon_row_actions($post, $title);
             break;
         case 'shortcode':
             $shortcode = '[social_icons_group id="' . $post->ID . '"]';
             echo '<span class="shortcode"><input type="text" class="regular-text code" onfocus="this.select();" readonly="readonly" value="' . esc_attr($shortcode) . '" /></span>';
             break;
         default:
             break;
     }
 }
开发者ID:themegrill,项目名称:social-icons,代码行数:24,代码来源:class-si-admin-post-types.php

示例15: handle_row_actions

 /**
  * Generates and displays row action links.
  *
  * @since 4.3.0
  * @access protected
  *
  * @param object $post        Attachment being acted upon.
  * @param string $column_name Current column name.
  * @param string $primary     Primary column name.
  * @return string Row actions output for media attachments.
  */
 protected function handle_row_actions($post, $column_name, $primary)
 {
     if ($primary !== $column_name) {
         return '';
     }
     $att_title = _draft_or_post_title();
     return $this->row_actions($this->_get_row_actions($post, $att_title));
 }
开发者ID:KillerDesigner,项目名称:projectnami,代码行数:19,代码来源:class-wp-media-list-table.php


注:本文中的_draft_or_post_title函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。