• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_revisions_to_keep函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: wp_revisions_enabled

/**
 * Determine if revisions are enabled for a given post.
 *
 * @since 3.6.0
 *
 * @param WP_Post $post The post object.
 * @return bool True if number of revisions to keep isn't zero, false otherwise.
 */
function wp_revisions_enabled($post)
{
    return wp_revisions_to_keep($post) !== 0;
}
开发者ID:AndreyLanko,项目名称:perevorot-prozorro-wp,代码行数:12,代码来源:revision.php


示例2: post_submit_meta_box


//.........这里部分代码省略.........
<?php 
    }
    ?>

</div><!-- .misc-pub-section -->

<?php 
    /* translators: Publish box date format, see http://php.net/date */
    $datef = __('M j, Y @ H:i');
    if (0 != $post->ID) {
        if ('future' == $post->post_status) {
            // scheduled for publishing at a future date
            $stamp = __('Scheduled for: <b>%1$s</b>');
        } elseif ('publish' == $post->post_status || 'private' == $post->post_status) {
            // already published
            $stamp = __('Published on: <b>%1$s</b>');
        } elseif ('0000-00-00 00:00:00' == $post->post_date_gmt) {
            // draft, 1 or more saves, no date specified
            $stamp = __('Publish <b>immediately</b>');
        } elseif (time() < strtotime($post->post_date_gmt . ' +0000')) {
            // draft, 1 or more saves, future date specified
            $stamp = __('Schedule for: <b>%1$s</b>');
        } else {
            // draft, 1 or more saves, date specified
            $stamp = __('Publish on: <b>%1$s</b>');
        }
        $date = date_i18n($datef, strtotime($post->post_date));
    } else {
        // draft (no saves, and thus no date specified)
        $stamp = __('Publish <b>immediately</b>');
        $date = date_i18n($datef, strtotime(current_time('mysql')));
    }
    if (!empty($args['args']['revisions_count'])) {
        $revisions_to_keep = wp_revisions_to_keep($post);
        ?>
<div class="misc-pub-section misc-pub-revisions">
<?php 
        if ($revisions_to_keep > 0 && $revisions_to_keep <= $args['args']['revisions_count']) {
            echo '<span title="' . esc_attr(sprintf(__('Your site is configured to keep only the last %s revisions.'), number_format_i18n($revisions_to_keep))) . '">';
            printf(__('Revisions: %s'), '<b>' . number_format_i18n($args['args']['revisions_count']) . '+</b>');
            echo '</span>';
        } else {
            printf(__('Revisions: %s'), '<b>' . number_format_i18n($args['args']['revisions_count']) . '</b>');
        }
        ?>
	<a class="hide-if-no-js" href="<?php 
        echo esc_url(get_edit_post_link($args['args']['revision_id']));
        ?>
"><span aria-hidden="true"><?php 
        _ex('Browse', 'revisions');
        ?>
</span> <span class="screen-reader-text"><?php 
        _e('Browse revisions');
        ?>
</span></a>
</div>
<?php 
    }
    if ($can_publish) {
        // Contributors don't get to choose the date of publish
        ?>
<div class="misc-pub-section curtime misc-pub-curtime">
	<span id="timestamp">
	<?php 
        printf($stamp, $date);
        ?>
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:67,代码来源:meta-boxes.php


示例3: revisions_meta_box

    /**
     * Render metabox listing CSS revisions and the themes that correspond to the revisions.
     * Called by safecss_admin
     *
     * @global $post
     * @param array $safecss_post
     * @uses wp_revisions_to_keep
     * @uses WP_Query
     * @uses wp_post_revision_title
     * @uses esc_html
     * @uses add_query_arg
     * @uses menu_page_url
     * @uses wp_reset_query
     * @return string
     */
    static function revisions_meta_box($safecss_post)
    {
        $show_all_revisions = isset($_GET['show_all_rev']);
        if (function_exists('wp_revisions_to_keep')) {
            $max_revisions = wp_revisions_to_keep((object) $safecss_post);
        } else {
            $max_revisions = defined('WP_POST_REVISIONS') && is_numeric(WP_POST_REVISIONS) ? (int) WP_POST_REVISIONS : 25;
        }
        $posts_per_page = $show_all_revisions ? $max_revisions : 6;
        $revisions = new WP_Query(array('posts_per_page' => $posts_per_page, 'post_type' => 'revision', 'post_status' => 'inherit', 'post_parent' => $safecss_post['ID'], 'orderby' => 'date', 'order' => 'DESC'));
        if ($revisions->have_posts()) {
            ?>
			<ul class="post-revisions"><?php 
            global $post;
            while ($revisions->have_posts()) {
                $revisions->the_post();
                ?>
<li>
					<?php 
                echo wp_post_revision_title($post);
                if (!empty($post->post_excerpt)) {
                    echo ' (' . esc_html($post->post_excerpt) . ')';
                }
                ?>
				</li><?php 
            }
            ?>
</ul><?php 
            if ($revisions->found_posts > 6 && !$show_all_revisions) {
                ?>
				<br>
				<a href="<?php 
                echo add_query_arg('show_all_rev', 'true', menu_page_url('editcss', false));
                ?>
"><?php 
                esc_html_e('Show all', 'jetpack');
                ?>
</a>
				<?php 
            }
        }
        wp_reset_query();
    }
开发者ID:pcuervo,项目名称:wp-carnival,代码行数:58,代码来源:custom-css.php


示例4: __

                    $stamp = __('Schedule for: <b>%1$s</b>');
                } else {
                    // draft, 1 or more saves, date specified
                    $stamp = __('Publish on: <b>%1$s</b>');
                }
            }
        }
    }
    $date = date_i18n($datef, strtotime($post->post_date));
} else {
    // draft (no saves, and thus no date specified)
    $stamp = __('Publish <b>immediately</b>');
    $date = date_i18n($datef, strtotime(current_time('mysql')));
}
if (!empty($args['args']['revisions_count'])) {
    $revisions_to_keep = wp_revisions_to_keep($post);
    ?>
        <div class="misc-pub-section misc-pub-revisions">
            <?php 
    if ($revisions_to_keep > 0 && $revisions_to_keep <= $args['args']['revisions_count']) {
        echo '<span title="' . esc_attr(sprintf(__('Your site is configured to keep only the last %s revisions.'), number_format_i18n($revisions_to_keep))) . '">';
        printf(__('Revisions: %s'), '<b>' . number_format_i18n($args['args']['revisions_count']) . '+</b>');
        echo '</span>';
    } else {
        printf(__('Revisions: %s'), '<b>' . number_format_i18n($args['args']['revisions_count']) . '</b>');
    }
    ?>
            <a class="hide-if-no-js" href="<?php 
    echo esc_url(get_edit_post_link($args['args']['revision_id']));
    ?>
"><span aria-hidden="true"><?php 
开发者ID:johnulist,项目名称:framework,代码行数:31,代码来源:minor.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_richedit_pre函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_revisions_enabled函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap