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

PHP get_post_time函数代码示例

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

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



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

示例1: realistic_time_ago

function realistic_time_ago()
{
    global $post;
    $date = get_post_time('G', true, $post);
    // Array of time period chunks
    $chunks = array(array(60 * 60 * 24 * 365, __('year', 'realistic'), __('years', 'realistic')), array(60 * 60 * 24 * 30, __('month', 'realistic'), __('months', 'realistic')), array(60 * 60 * 24 * 7, __('week', 'realistic'), __('weeks', 'realistic')), array(60 * 60 * 24, __('day', 'realistic'), __('days', 'realistic')), array(60 * 60, __('hour', 'realistic'), __('hours', 'realistic')), array(60, __('minute', 'realistic'), __('minutes', 'realistic')), array(1, __('second', 'realistic'), __('seconds', 'realistic')));
    if (!is_numeric($date)) {
        $time_chunks = explode(':', str_replace(' ', ':', $date));
        $date_chunks = explode('-', str_replace(' ', '-', $date));
        $date = gmmktime((int) $time_chunks[1], (int) $time_chunks[2], (int) $time_chunks[3], (int) $date_chunks[1], (int) $date_chunks[2], (int) $date_chunks[0]);
    }
    $current_time = current_time('mysql', $gmt = 0);
    $newer_date = strtotime($current_time);
    // Difference in seconds
    $since = $newer_date - $date;
    // Something went wrong with date calculation and we ended up with a negative date.
    if (0 > $since) {
        return __('sometime', 'realistic');
    }
    //Step one: the first chunk
    for ($i = 0, $j = count($chunks); $i < $j; $i++) {
        $seconds = $chunks[$i][0];
        // Finding the biggest chunk (if the chunk fits, break)
        if (($count = floor($since / $seconds)) != 0) {
            break;
        }
    }
    // Set output var
    $output = 1 == $count ? '1 ' . $chunks[$i][1] : $count . ' ' . $chunks[$i][2];
    if (!(int) trim($output)) {
        $output = '0 ' . __('seconds', 'realistic');
    }
    $output .= __(' ago', 'realistic');
    return $output;
}
开发者ID:benediktharter,项目名称:Realistic,代码行数:35,代码来源:template-tags.php


示例2: getPostData

 public function getPostData()
 {
     $fooName = 'bbp_get_' . $this->postType . '_content';
     $content = $fooName($this->postId);
     $return = array('autor' => array('isCurrentUser' => $this->autorId == get_current_user_id(), 'url' => bp_core_get_user_domain($this->autorId), 'avatar' => bp_core_fetch_avatar(array('item_id' => $autorId, 'height' => $imgSize, 'width' => $imgSize)), 'name' => bbp_get_reply_author_display_name($this->postId)), 'type' => $this->postType, 'attachmentList' => $this->_getAttachmentList(), 'sContent' => bbp_get_reply_content($this->postId), 'id' => $this->postId, 'likes' => 0, 'sDate' => get_post_time('j F ', false, $this->postId, true) . __('at', 'qode') . get_post_time(' H:i', false, $this->postId, true), 'sContentShort' => mb_substr($content, 0, 500), 'sContent' => $content, 'like' => get_post_meta($this->postId, 'likes', true), 'isLiked' => get_post_meta($this->postId, 'like_' . $autorId, true));
     return $return;
 }
开发者ID:Bnei-Baruch,项目名称:Forum-bbpres-,代码行数:7,代码来源:forum-bbpAjaxIntegrator.php


示例3: column_date

 function column_date($post)
 {
     if ('0000-00-00 00:00:00' == $post->post_date) {
         $t_time = $h_time = __('Unpublished');
         $time_diff = 0;
     } else {
         $t_time = get_the_time(__('Y/m/d g:i:s A'));
         $m_time = $post->post_date;
         $time = get_post_time('G', true, $post);
         $time_diff = time() - $time;
         if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) {
             $h_time = sprintf(__('%s ago'), human_time_diff($time));
         } else {
             $h_time = mysql2date(__('Y/m/d'), $m_time);
         }
     }
     if ('excerpt' == $mode) {
         echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
     } else {
         echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
     }
     echo '<br />';
     if ('publish' == $post->post_status) {
         _e('Published');
     } elseif ('future' == $post->post_status) {
         if ($time_diff > 0) {
             echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
         } else {
             _e('Scheduled');
         }
     } else {
         _e('Last Modified');
     }
 }
开发者ID:uoyknaht,项目名称:kc,代码行数:34,代码来源:film-register-film-list-table.class.php


示例4: sp_get_time

function sp_get_time($post = 0, $format = null)
{
    if (null == $format) {
        $format = get_option('time_format');
    }
    return get_post_time($format, false, $post, true);
}
开发者ID:engrmostafijur,项目名称:SportsPress,代码行数:7,代码来源:sp-api-functions.php


示例5: column_date

 function column_date($post)
 {
     $html = '';
     if ('0000-00-00 00:00:00' == $post->post_date) {
         $t_time = $h_time = __('Unpublished', 'jetpack');
         $time_diff = 0;
     } else {
         $t_time = date(__('Y/m/d g:i:s A', 'jetpack'), mysql2date('G', $post->post_date));
         $m_time = $post->post_date;
         $time = get_post_time('G', true, $post);
         $time_diff = time() - $time;
         if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) {
             $h_time = sprintf(__('%s ago', 'jetpack'), human_time_diff($time));
         } else {
             $h_time = mysql2date(__('Y/m/d', 'jetpack'), $m_time);
         }
     }
     $html .= '<abbr title="' . esc_attr($t_time) . '">' . esc_html($h_time) . '</abbr>';
     $html .= '<br />';
     if ('publish' == $post->post_status) {
         $html .= esc_html__('Published', 'jetpack');
     } elseif ('future' == $post->post_status) {
         if ($time_diff > 0) {
             $html .= '<strong class="attention">' . esc_html__('Missed schedule', 'jetpack') . '</strong>';
         } else {
             $html .= esc_html__('Scheduled', 'jetpack');
         }
     } else {
         $html .= esc_html__('Last Modified', 'jetpack');
     }
     return $html;
 }
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:32,代码来源:omnisearch-posts.php


示例6: maybe_add_robots

 function maybe_add_robots()
 {
     global $post;
     if (is_singular() && bbp_is_topic($post->ID) && bbp_is_topic_closed($post->ID) && time() - get_post_time('U', true, $post) > YEAR_IN_SECONDS) {
         echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
     }
 }
开发者ID:jmdodd,项目名称:old-robots,代码行数:7,代码来源:old-robots.php


示例7: apip_sameday_post

/**
 * 作用: 显示历史相同日文章
 * 来源: 自产
 * URL:  
 */
function apip_sameday_post()
{
    global $wpdb;
    $month = get_post_time('m');
    $day = get_post_time('j');
    $id = get_the_ID();
    global $apip_options;
    $limit = $apip_options['local_definition_count'] ? $apip_options['local_definition_count'] : 5;
    $ret = '<ul class = "apip-history-content">';
    $sql = "select ID, year(post_date) as h_year, post_title FROM \r\n            {$wpdb->posts} WHERE post_password = '' AND post_type = 'post' AND post_status = 'publish' \r\n            AND month(post_date)='{$month}' AND day(post_date)='{$day}' AND ID != '{$id}' \r\n            order by post_date LIMIT {$limit}";
    $history_posts = $wpdb->get_results($sql);
    $rcount = $limit - count($history_posts);
    if ($rcount > 0) {
        $random_posts = apip_random_post(get_the_ID(), $rcount);
    }
    foreach ($history_posts as $history_post) {
        $ret = $ret . '<li><span>' . $history_post->h_year . ':&nbsp;&nbsp;<span><a class="sameday-post" href="' . get_permalink($history_post->ID) . '">';
        $ret = $ret . $history_post->post_title . '</a></li>';
    }
    if ($rcount > 0) {
        foreach ($random_posts as $random_post) {
            $ret = $ret . '<li><span>RAND:&nbsp;&nbsp;</span><a class="sameday-post" href="' . get_permalink($random_post->ID) . '">';
            $ret = $ret . $random_post->post_title . '</a></li>';
        }
    }
    $ret = $ret . '</ul>';
    return $ret;
}
开发者ID:lifishake,项目名称:apip,代码行数:33,代码来源:apip-func.php


示例8: get_time

 /**
  * WP filter handler. Returns:
  * - Relative date.
  * - Absolute date with `$this->wp_fallback` format, if relative is not suitable.
  *
  * @param int $wp_time		- Timestamp?
  * @return string
  */
 public function get_time($wp_time)
 {
     global $post;
     $time = get_post_time('U', true, $post);
     $diff = $this->diff($time, null, true, false, $this->wp_fallback);
     return !is_int($diff) ? $diff : $wp_time;
 }
开发者ID:cibulka,项目名称:cibulka-wp-plugin-theme,代码行数:15,代码来源:WPRelativeDate.php


示例9: widget

 function widget($args, $instance)
 {
     global $post;
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $title = !empty($instance['title']) ? $instance['title'] : '';
     if (!is_single()) {
         return;
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title;
         echo $title;
         echo $after_title;
     }
     $name = get_the_author_meta('display_name', $post->post_author);
     echo '<div class="large-icons">';
     echo '<ul>';
     edit_post_link('<i class="icon-pencil"></i>' . __('Edit', 'myThemes'), '<li>', '</li>');
     echo '<li><a href="' . get_day_link(get_post_time('Y', false, $post->ID), get_post_time('m', false, $post->ID), get_post_time('d', false, $post->ID)) . '">';
     echo '<time datetime="' . get_post_time('Y-m-d', false, $post->ID) . '"><i class="icon-calendar"></i>' . get_post_time(get_option('date_format'), false, $post->ID) . '</time></a></li>';
     echo '<li><a href="' . get_author_posts_url($post->post_author) . '" title="' . __('Writed by ', 'myThemes') . ' ' . $name . '"><i class="icon-user-5"></i>' . $name . '</a></li>';
     if ($post->comment_status == 'open') {
         $nr = get_comments_number($post->ID);
         if ($nr == 1) {
             $comments = $nr . ' ' . __('Comment', 'myThemes');
         } else {
             $comments = $nr . ' ' . __('Comments', 'myThemes');
         }
         echo '<li><a href="' . get_comments_link($post->ID) . '"><i class="icon-comment"></i>' . $comments . '</a></li>';
     }
     echo '</ul>';
     echo '</div>';
     echo $after_widget;
 }
开发者ID:mathieu-aubin,项目名称:verbo-linuq,代码行数:35,代码来源:my_wdg_meta.php


示例10: write_here_time_edit

function write_here_time_edit($edit = 1, $for_post = 1, $tab_index = 0, $multi = 0)
{
    global $wp_locale, $comment;
    // Get post ID from URL and assign it to 'get_post' to get post info
    $post_id = $_REQUEST['post'];
    $post = get_post($post_id);
    if ($for_post) {
        $edit = !(in_array($post->post_status, array('draft', 'pending')) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt));
    }
    $tab_index_attribute = '';
    if ((int) $tab_index > 0) {
        $tab_index_attribute = " tabindex=\"{$tab_index}\"";
    }
    // todo: Remove this?
    // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
    // Assign published date of posts instead of current time
    $time_adj = get_post_time('U', true, $post_id);
    $post_date = $post->post_date;
    $jj = $edit ? mysql2date('d', $post_date, false) : gmdate('d', $time_adj);
    $mm = $edit ? mysql2date('m', $post_date, false) : gmdate('m', $time_adj);
    $aa = $edit ? mysql2date('Y', $post_date, false) : gmdate('Y', $time_adj);
    $hh = $edit ? mysql2date('H', $post_date, false) : gmdate('H', $time_adj);
    $mn = $edit ? mysql2date('i', $post_date, false) : gmdate('i', $time_adj);
    $ss = $edit ? mysql2date('s', $post_date, false) : gmdate('s', $time_adj);
    $cur_jj = gmdate('d', $time_adj);
    $cur_mm = gmdate('m', $time_adj);
    $cur_aa = gmdate('Y', $time_adj);
    $cur_hh = gmdate('H', $time_adj);
    $cur_mn = gmdate('i', $time_adj);
    $month = '<label><span class="screen-reader-text">' . __('Month') . '</span><select ' . ($multi ? '' : 'id="mm" ') . 'name="mm"' . $tab_index_attribute . ">\n";
    for ($i = 1; $i < 13; $i = $i + 1) {
        $monthnum = zeroise($i, 2);
        $monthtext = $wp_locale->get_month_abbrev($wp_locale->get_month($i));
        $month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected($monthnum, $mm, false) . '>';
        /* translators: 1: month number (01, 02, etc.), 2: month abbreviation */
        $month .= sprintf(__('%1$s-%2$s'), $monthnum, $monthtext) . "</option>\n";
    }
    $month .= '</select></label>';
    $day = '<label><span class="screen-reader-text">' . __('Day') . '</span><input type="text" ' . ($multi ? '' : 'id="jj" ') . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
    $year = '<label><span class="screen-reader-text">' . __('Year') . '</span><input type="text" ' . ($multi ? '' : 'id="aa" ') . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" /></label>';
    $hour = '<label><span class="screen-reader-text">' . __('Hour') . '</span><input type="text" ' . ($multi ? '' : 'id="hh" ') . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
    $minute = '<label><span class="screen-reader-text">' . __('Minute') . '</span><input type="text" ' . ($multi ? '' : 'id="mn" ') . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
    echo '<div class="timestamp-wrap">';
    /* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
    printf(__('%1$s %2$s, %3$s @ %4$s:%5$s'), $month, $day, $year, $hour, $minute);
    echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
    if ($multi) {
        return;
    }
    echo "\n\n";
    $map = array('mm' => array($mm, $cur_mm), 'jj' => array($jj, $cur_jj), 'aa' => array($aa, $cur_aa), 'hh' => array($hh, $cur_hh), 'mn' => array($mn, $cur_mn));
    foreach ($map as $timeunit => $value) {
        list($unit, $curr) = $value;
        echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $unit . '" />' . "\n";
        $cur_timeunit = 'cur_' . $timeunit;
        echo '<input type="hidden" id="' . $cur_timeunit . '" name="' . $cur_timeunit . '" value="' . $curr . '" />' . "\n";
    }
}
开发者ID:seanyainkiranina,项目名称:Write-Here,代码行数:58,代码来源:write-here-time.php


示例11: get_post_data

function get_post_data($post_object)
{
    global $post;
    $post = $post_object;
    setup_postdata($post);
    $post_class = get_post_class();
    $post_data = array('author' => get_the_author(), 'author_url' => get_author_posts_url(get_the_author_meta('ID')), 'classes' => join(' ', $post_class), 'content' => get_the_content(), 'date' => get_the_date(), 'datetime' => get_post_time('c', true), 'excerpt' => get_the_excerpt(), 'json_url' => '/wp-json/wp/v2/posts/' . get_the_ID(), 'title' => get_the_title(), 'link' => str_replace(home_url(), '', get_the_permalink()));
    return $post_data;
}
开发者ID:asithappens,项目名称:sage,代码行数:9,代码来源:extras.php


示例12: widget

    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Popular Posts', 'heal') : $instance['title'], $instance, $this->id_base);
        $count = empty($instance['count']) ? 5 : $instance['count'];
        echo $before_widget;
        echo $before_title . $title . $after_title;
        ?>
            <ul class="popular-post">

                <?php 
        $pc = new WP_Query('orderby=comment_count&posts_per_page=' . $count . '');
        while ($pc->have_posts()) {
            $pc->the_post();
            ?>
                    <li>
                        <?php 
            if (has_post_thumbnail()) {
                the_post_thumbnail('widget-thumb');
            } else {
                echo '<img src="' . get_template_directory_uri() . '/assets/images/no-img-thumb.jpg">';
            }
            ?>
                    <a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a> <br/ >
                    <time class="post-meta-element" datetime="<?php 
            echo get_post_time('U', true);
            ?>
"><?php 
            echo get_the_date('j F, Y');
            ?>
</time> | <span class="popular-post-comment"> <?php 
            comments_popup_link('No Comments;', '1 Comment', '% Comments');
            ?>
</span>
                    </li>
                <?php 
        }
        ?>
                <?php 
        wp_reset_query();
        ?>
            </ul><!-- /.latest-post -->

            <?php 
        echo $after_widget;
    }
开发者ID:ORNChurch,项目名称:ornchurch.org,代码行数:63,代码来源:widget.php


示例13: listing_page__get_the_date

 public function listing_page__get_the_date($the_date, $d = '')
 {
     if (!$this->listing_id) {
         return $the_date;
     }
     if (!$d) {
         $d = get_option('date_format');
     }
     //remove_filter( 'get_the_date', array( &$this, 'listing_page__get_the_date' ), 10, 2 );
     return get_post_time($d, $this->listing_id);
 }
开发者ID:Nedick,项目名称:stzagora-website,代码行数:11,代码来源:class-page-meta.php


示例14: simple_life_posted_on

 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function simple_life_posted_on()
 {
     $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
     if (get_the_time('U') !== get_the_modified_time('U')) {
         $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
     }
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $posted_on = sprintf('%s', '<i class="fa fa-calendar" aria-hidden="true"></i> <a href="' . esc_url(get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j'))) . '" rel="bookmark">' . $time_string . '</a>');
     $byline = sprintf('<i class="fa fa-user" aria-hidden="true"></i> %s', '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
     echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
     // WPCS: XSS OK.
 }
开发者ID:ernilambar,项目名称:simple-life,代码行数:15,代码来源:template-tags.php


示例15: dynamictime

function dynamictime()
{
    global $post;
    $date = $post->post_date;
    $time = get_post_time('G', true, $post);
    $mytime = time() - $time;
    if ($mytime > 0 && $mytime < 24 * 60 * 60) {
        $mytimestamp = sprintf(__('%s ago'), human_time_diff($time));
    } else {
        $mytimestamp = date(get_option('date_format'), strtotime($date));
    }
    return $mytimestamp;
}
开发者ID:rcorazza,项目名称:ith,代码行数:13,代码来源:functions.php


示例16: gardenia_entry_meta

function gardenia_entry_meta()
{
    $gardenia_categories_list = get_the_category_list(',', '');
    $gardenia_tag_list = get_the_tag_list('', ',');
    $gardenia_author = get_the_author();
    $gardenia_author_url = esc_url(get_author_posts_url(get_the_author_meta('ID')));
    $gardenia_comments = wp_count_comments(get_the_ID());
    $gardenia_date = sprintf('<time datetime="%1$s">%2$s</time>', sanitize_text_field(get_the_date('c')), esc_html(get_the_date()));
    ?>
	
		<div class="fancy_categories">
                <div class="glyphicon glyphicon-user color"><a href="<?php 
    echo $gardenia_author_url;
    ?>
" rel="tag"><?php 
    echo $gardenia_author;
    ?>
</a></div>
                <div class="glyphicon glyphicon-calendar color"><a href="<?php 
    echo esc_url(get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j')));
    ?>
" rel="tag"><?php 
    echo $gardenia_date;
    ?>
</a></div>
               <?php 
    if (!empty($gardenia_tag_list)) {
        ?>
<div class="glyphicon glyphicon-tag color"><?php 
        echo $gardenia_tag_list;
        ?>
</div><?php 
    }
    ?>
               <?php 
    if (!empty($gardenia_categories_list)) {
        ?>
<div class="glyphicon glyphicon-folder-open color"><?php 
        echo $gardenia_categories_list;
        ?>
</div><?php 
    }
    ?>
                <div class="glyphicon glyphicon-comment color"><span class="comment"><?php 
    comments_number(__('No Comments', 'gardenia'), __('1 Comment', 'gardenia'), __('% Comments', 'gardenia'));
    ?>
</span></div>
		</div>
<?php 
}
开发者ID:jasmun,项目名称:Noco100,代码行数:50,代码来源:theme-default-setup.php


示例17: tcc_time_flags

function tcc_time_flags($post_id = 0) { //判斷時間軸
    $t1 = date("Y-m-d H:i:s",mktime(date("H"), date("i"), date("s"), date("m"), date("d") - 7, date("Y"))); // 7天內新訊息
    $t2 = get_post_time('Y-m-d H:i:s');
    if ($t1 < $t2) {
        echo "<span class='glyphicon glyphicon-ok-sign aria-hidden='true' title='" . __('New', 'tcc') . "' style='color:green;'></span>";
    }
    if (get_post_meta($post_id, '_expiration', true) != '') {
        $t1 = date("Y-m-d H:i:s",mktime(date("H"), date("i"), date("s"), date("m"), date("d") + 7, date("Y"))); // 7天內到期
        $t2 = date_format(date_create(get_post_meta($post_id, '_expiration', true)), 'Y-m-d H:i:s');
        if ($t1 > $t2) {
            echo "<span class='glyphicon glyphicon-time' aria-hidden='true' title='" . __('Upcoming', 'tcc') . "' style='color:red;'></span>";
        }
    }
}
开发者ID:TCCinTaiwan,项目名称:KUAS_CSIE_Wordpress_Themes_TCC-Department,代码行数:14,代码来源:message.php


示例18: wpbppost_meta

    function wpbppost_meta()
    {
        ?>

<ul class="post-meta inline-list">
  <li>
    Posted:
    <a href="<?php 
        echo get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j'));
        ?>
">
      <?php 
        printf('<time datetime="%1$s">%2$s</time>', esc_attr(get_the_date('c')), esc_html(get_the_date()));
        ?>
    </a>
  </li>
  <li>
    <?php 
        the_tags('Tags: ', ', ', '');
        ?>
  </li>
  <li>
    <?php 
        $categories = get_the_category();
        $separator = ', ';
        $output = '';
        if (!empty($categories)) {
            foreach ($categories as $category) {
                $output .= '<a href="' . esc_url(get_category_link($category->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts in %s', 'textdomain'), $category->name)) . '">' . esc_html($category->name) . '</a>' . $separator;
            }
            echo 'Categories: ';
            echo trim($output, $separator);
        }
        ?>
  </li>
  <li>
    Author:
    <a href="<?php 
        echo esc_url(get_author_posts_url(get_the_author_meta('ID')));
        ?>
"><?php 
        echo get_the_author_meta('display_name');
        ?>
</a>
  </li>
</ul>

<?php 
    }
开发者ID:tgallimore,项目名称:wp-boilerplate,代码行数:49,代码来源:template-tags.php


示例19: avocation_entry_meta

function avocation_entry_meta()
{
    $avocation_category_list = get_the_category_list(', ', ' <i class="fa fa-list-all"></i> ');
    $avocation_tag_list = get_the_tag_list('<i class="fa fa-tags"></i> ', ' , ');
    $avocation_date = sprintf('<time datetime="%1$s">%2$s</time>', esc_attr(get_the_date('c')), esc_html(get_the_date()));
    $avocation_author = sprintf('<a href="%1$s" title="%2$s" >%3$s</a>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'avocation'), get_the_author())), get_the_author());
    if ($avocation_category_list) {
        $avocation_utility_text = '<div class="blog-meta"><ul><li><a href=' . esc_url(get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j'))) . ' > <i class="fa fa-calendar"></i> %3$s </a></li> <li> <i class="fa fa-user"></i> %4$s </li> <li>  %2$s </li> <li> <i class="fa fa-list-alt"></i> %1$s </li> <li> <i class="fa fa-comment"></i> ' . avocation_comment_number_custom() . '</li></ul></div>';
    } elseif ($avocation_tag_list) {
        $avocation_utility_text = '<div class="blog-meta"><ul><li><a href=' . esc_url(get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j'))) . ' > <i class="fa fa-calendar"></i> %3$s </a></li> <li> <i class="fa fa-user"></i> %4$s </li> </li> <li>  %2$s </li>  <li>  %1$s </li> <li> <i class="fa fa-comment"></i> ' . avocation_comment_number_custom() . '</li></ul></div>';
    } else {
        $avocation_utility_text = '<div class="blog-meta"><ul><li><a href=' . esc_url(get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j'))) . ' > <i class="fa fa-calendar"></i> %3$s </a></li> <li> <i class="fa fa-user"></i> %4$s </li>  <li> <i class="fa fa-comment"></i> ' . avocation_comment_number_custom() . '</li></ul></div>';
    }
    printf($avocation_utility_text, $avocation_category_list, $avocation_tag_list, $avocation_date, $avocation_author);
}
开发者ID:stvnfrancisco,项目名称:art_portfolio_wordpress,代码行数:15,代码来源:theme-default-setup.php


示例20: filter_post_link

 /**
  * Filters the month name and month code tags
  */
 public static function filter_post_link($permalink, $post)
 {
     if (false === strpos($permalink, '%monthname%') && false === strpos($permalink, '%monthcode%')) {
         return $permalink;
     }
     try {
         $monthindex = intval(get_post_time('n', "GMT" == false, $post->ID));
         $monthname = self::$monthnames[$monthindex - 1];
         $monthcode = self::$monthcodes[$monthindex - 1];
         $permalink = str_replace('%monthname%', $monthname, $permalink);
         $permalink = str_replace('%monthcode%', $monthcode, $permalink);
         return $permalink;
     } catch (Exception $e) {
         return $permalink;
     }
 }
开发者ID:anandamd,项目名称:month-name-permalink,代码行数:19,代码来源:month-name-permalink.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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