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


PHP get_day_link函数代码示例

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


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

示例1: published_time_links

 function published_time_links()
 {
     $archive_year = get_the_time('Y');
     $archive_month = get_the_time('m');
     $archive_day = get_the_time('d');
     echo get_day_link($archive_year, $archive_month, $archive_day);
 }
开发者ID:luisomontano,项目名称:ProtoCulture,代码行数:7,代码来源:options-plugins.php

示例2: 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

示例3: zerif_posted_on_child

 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function zerif_posted_on_child()
 {
     $time_string = '<time class="entry-date published" itemprop="datePublished" 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()));
     printf(__('<span class="posted-on">Originally appeared in <a href="%2$s">%3$s</a> on  %1$s</span>', 'zerif'), sprintf('<a href="%1$s" rel="bookmark">%2$s</a>', esc_url(get_day_link(get_the_date('Y'), get_the_date('m'), get_the_date('d'))), $time_string), esc_attr(get_field('original_source_url')), esc_attr(get_field('original_source_media_outlet')));
 }
开发者ID:sdathletics,项目名称:zmc,代码行数:12,代码来源:template-tags-child.php

示例4: 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

示例5: test_page_type_date

 public function test_page_type_date()
 {
     $this->go_to(get_year_link('2015'));
     $this->assertTrue(is_year());
     $this->assertSame('date', Ad_Layers::instance()->get_current_page_type());
     $this->go_to(get_month_link('2015', '03'));
     $this->assertTrue(is_month());
     $this->assertSame('date', Ad_Layers::instance()->get_current_page_type());
     $this->go_to(get_day_link('2015', '03', '14'));
     $this->assertTrue(is_day());
     $this->assertSame('date', Ad_Layers::instance()->get_current_page_type());
 }
开发者ID:statnews,项目名称:ad-layers,代码行数:12,代码来源:test-page-types.php

示例6: tc_post_metas

        /**
         * The template part for displaying entry metas
         *
         * @package Customizr
         * @since Customizr 1.0
         */
        function tc_post_metas()
        {
            global $post;
            //when do we display the metas ?
            //1) we don't show metas on home page, 404, search page by default
            //2) +filter conditions
            $post_metas_bool = tc__f('__is_home') || is_404() || 'page' == $post->post_type ? false : true;
            $post_metas_bool = apply_filters('tc_show_post_metas', $post_metas_bool);
            if (!$post_metas_bool) {
                return;
            }
            ob_start();
            ?>

            <div class="entry-meta">
                <?php 
            if ('attachment' == $post->post_type) {
                $metadata = wp_get_attachment_metadata();
                printf('%1$s <span class="entry-date"><time class="entry-date updated" datetime="%2$s">%3$s</time></span> %4$s %5$s', '<span class="meta-prep meta-prep-entry-date">' . __('Published', 'customizr') . '</span>', apply_filters('tc_use_the_post_modified_date', false) ? esc_attr(get_the_date('c')) : esc_attr(get_the_modified_date('c')), esc_html(get_the_date()), isset($metadata['width']) && isset($metadata['height']) ? __('at dimensions', 'customizr') . '<a href="' . esc_url(wp_get_attachment_url()) . '" title="' . __('Link to full-size image', 'customizr') . '"> ' . $metadata['width'] . ' &times; ' . $metadata['height'] . '</a>' : '', __('in', 'customizr') . '<a href="' . esc_url(get_permalink($post->post_parent)) . '" title="' . __('Return to ', 'customizr') . esc_attr(strip_tags(get_the_title($post->post_parent))) . '" rel="gallery"> ' . get_the_title($post->post_parent) . '</a>.');
            } else {
                $categories_list = $this->tc_category_list();
                $tag_list = $this->tc_tag_list();
                $date = apply_filters('tc_date_meta', sprintf('<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date updated" datetime="%3$s">%4$s</time></a>', esc_url(get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d'))), esc_attr(get_the_time()), apply_filters('tc_use_the_post_modified_date', false) ? esc_attr(get_the_date('c')) : esc_attr(get_the_modified_date('c')), esc_html(get_the_date())));
                //end filter
                $author = apply_filters('tc_author_meta', sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'customizr'), get_the_author())), get_the_author()));
                //end filter
                // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
                $utility_text = '';
                if ($tag_list) {
                    $utility_text = __('This entry was posted in %1$s and tagged %2$s on %3$s<span class="by-author"> by %4$s</span>.', 'customizr');
                } elseif ($categories_list) {
                    $utility_text = __('This entry was posted in %1$s on %3$s<span class="by-author"> by %4$s</span>.', 'customizr');
                } else {
                    $utility_text = __('This entry was posted on %3$s<span class="by-author"> by %4$s</span>.', 'customizr');
                }
                $utility_text = apply_filters('tc_meta_utility_text', $utility_text);
                //echoes every metas components
                printf($utility_text, $categories_list, $tag_list, $date, $author);
            }
            //endif attachment
            ?>

            </div><!-- .entry-meta -->

            <?php 
            $html = ob_get_contents();
            if ($html) {
                ob_end_clean();
            }
            echo apply_filters('tc_post_metas', $html);
        }
开发者ID:andrewfandrew,项目名称:bronze-boar,代码行数:57,代码来源:class-content-post_metas.php

示例7: 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

示例8: 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

示例9: get_rocket_post_dates_urls

/**
 * Get all dates archives urls associated to a specific post
 *
 * @since 1.0
 *
 * @param int $post_ID The post ID
 * @return array $urls List of dates URLs
 */
function get_rocket_post_dates_urls($post_ID)
{
    // Get the day and month of the post
    $date = explode('-', get_the_time('Y-m-d', $post_ID));
    $urls = array(get_year_link($date[0]) . 'index.html', get_year_link($date[0]) . $GLOBALS['wp_rewrite']->pagination_base, get_month_link($date[0], $date[1]) . 'index.html', get_month_link($date[0], $date[1]) . $GLOBALS['wp_rewrite']->pagination_base, get_day_link($date[0], $date[1], $date[2]));
    /**
     * Filter the list of dates URLs
     *
     * @since 1.1.0
     *
     * @param array $urls List of dates URLs
     */
    $urls = apply_filters('rocket_post_dates_urls', $urls);
    return $urls;
}
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:23,代码来源:posts.php

示例10: 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

示例11: widget

 function widget($args, $instance)
 {
     global $post;
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $instance = wp_parse_args((array) $instance, array('title' => ''));
     $title = esc_attr($instance['title']);
     if (!is_single()) {
         return;
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title;
         echo apply_filters('widget_title', $title, $instance, $this->id_base);
         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>';
     }
     if (function_exists('stats_get_csv')) {
         $args = array('days' => -1, 'post_id' => $post->ID);
         $result = stats_get_csv('postviews', $args);
         $views = $result[0]['views'];
         $nr_views = number_format_i18n($views);
         $label_views = __('views', 'myThemes');
         if ($nr_views == 1) {
             $label_views = __('view', 'myThemes');
         }
         echo '<li><i class="icon-eye-2"></i> ' . $nr_views . ' ' . $label_views . '</li>';
     }
     echo '</ul>';
     echo '</div>';
     echo $after_widget;
 }
开发者ID:serpentinegalleries,项目名称:marathon-transformation,代码行数:47,代码来源:my_wdg_meta.php

示例12: widget

 function widget($args, $instance)
 {
     global $post;
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $instance = wp_parse_args((array) $instance, array('title' => ''));
     $title = $instance['title'];
     if (!is_single()) {
         return;
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title;
         echo apply_filters('widget_title', esc_attr($title), $instance, $this->id_base);
         echo $after_title;
     }
     $y = esc_attr(get_post_time('Y', false, $post->ID));
     $m = esc_attr(get_post_time('m', false, $post->ID));
     $d = esc_attr(get_post_time('d', false, $post->ID));
     $name = get_the_author_meta('display_name', $post->post_author);
     $dtime = get_post_time('Y-m-d', false, $post->ID);
     $ptime = get_post_time(esc_attr(get_option('date_format')), false, $post->ID, true);
     echo '<div class="large-icons">';
     echo '<ul>';
     edit_post_link('<i class="icon-pencil"></i>' . __('Edit', 'treeson'), '<li>', '</li>');
     echo '<li><a href="' . esc_url(get_day_link($y, $m, $d)) . '">';
     echo '<time datetime="' . esc_attr($dtime) . '"><i class="icon-calendar"></i>' . esc_html($ptime) . '</time></a></li>';
     echo '<li><a href="' . esc_url(get_author_posts_url($post->post_author)) . '" title="' . sprintf(__('Writed by %s', 'treeson'), esc_attr($name)) . '"><i class="icon-user-5"></i>' . esc_html($name) . '</a></li>';
     if ($post->comment_status == 'open') {
         $nr = get_comments_number($post->ID);
         echo '<li>';
         echo '<a href="' . esc_url(get_comments_link($post->ID)) . '">';
         echo '<i class="icon-comment"></i>';
         echo sprintf(_nx('%s Comment', '%s Comments', absint($nr), 'Number of comment(s) from widget "myThemes: Meta Details"', 'treeson'), number_format_i18n(absint($nr)));
         echo '</a></li>';
     }
     if (function_exists('stats_get_csv')) {
         $args = array('days' => -1, 'post_id' => $post->ID);
         $result = stats_get_csv('postviews', $args);
         $views = $result[0]['views'];
         echo '<li><i class="icon-eye-2"></i> ' . sprintf(_n('%s view', '%s views', absint($views), 'treeson'), number_format_i18n(absint($views))) . '</li>';
     }
     echo '</ul>';
     echo '</div>';
     echo $after_widget;
 }
开发者ID:roundtopdog,项目名称:wordpress,代码行数:46,代码来源:mythemes.post_meta.class.php

示例13: gdlr_get_cause_info

 function gdlr_get_cause_info($array = array(), $post_option = array(), $wrapper = true)
 {
     global $theme_option;
     $ret = '';
     foreach ($array as $post_info) {
         switch ($post_info) {
             case 'date':
                 $ret .= '<div class="cause-info cause-date"><i class="icon-time"></i>';
                 $ret .= '<a href="' . get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d')) . '">';
                 //$ret .= '<time date-time="' . get_the_time('Y-m-d') . '" pubdate>';
                 $ret .= get_the_time($theme_option['date-format']);
                 //$ret .= '</time>';
                 $ret .= '</a>';
                 $ret .= '</div>';
                 break;
             case 'category':
                 $cat = get_the_term_list(get_the_ID(), 'cause_category', '', '<span class="sep">,</span> ', '');
                 if (empty($cat)) {
                     break;
                 }
                 $ret .= '<div class="cause-info cause-category"><i class="icon-folder-close-alt"></i>';
                 $ret .= $cat;
                 $ret .= '</div>';
                 break;
             case 'pdf':
                 if (!empty($post_option['pdf'])) {
                     $ret .= '<div class="cause-info cause-pdf"><i class="icon-file-text"></i>';
                     $ret .= '<a href="' . wp_get_attachment_url($post_option['pdf']) . '" >';
                     $ret .= __('Download PDF', 'gdlr-cause');
                     $ret .= '</a>';
                     $ret .= '</div>';
                 }
                 break;
         }
     }
     if ($wrapper && !empty($ret)) {
         return '<div class="gdlr-cause-info">' . $ret . '<div class="clear"></div></div>';
     } else {
         if (!empty($ret)) {
             return $ret . '<div class="clear"></div>';
         }
     }
     return '';
 }
开发者ID:TheHiddenHaku,项目名称:fuzzy-waddle,代码行数:44,代码来源:gdlr-cause-item.php

示例14: get_post_footer

function get_post_footer()
{
    $p_y = get_the_time('Y');
    $p_m = get_the_time('m');
    $p_d = get_the_time('d');
    $p_date = $p_y . '/' . $p_m . '/' . $p_d;
    $p_link = get_permalink();
    $result = '<div class="post-footer"><a href="' . $p_link . '" title="' . $p_link . '">#</a> | ';
    $result .= '<a href="' . get_day_link($p_y, $p_m, $p_d) . '" title="' . $p_date . ' ' . get_the_time("h:i:s a") . '">' . $p_date . '</a> | ' . get_the_category_list(' &bull; ');
    if (!is_page() && comments_open()) {
        $c_num = get_comments_number();
        if ($c_num == 0) {
            $c = __('No Comments', 'nutcrackr');
        } elseif ($c_num > 1) {
            $c = sprintf(__('%d Comments', 'nutcrackr'), $c_num);
        } else {
            $c = __('1 Comment', 'nutcrackr');
        }
        $result .= ' | <span class="number-of-comments"><a href="' . $p_link . '#comments" title="' . __('comment', 'nutcrackr') . '">' . $c . '</a></span>';
    }
    $result .= '</div>';
    echo $result;
}
开发者ID:bodies,项目名称:wp-nodancer,代码行数:23,代码来源:functions.php

示例15: get_calendar


//.........这里部分代码省略.........
    }
    echo '
	</tr>
	</thead>

	<tfoot>
	<tr>';
    if ($previous) {
        if (function_exists('mb_substr')) {
            $smonth_name = mb_substr($month[zeroise($previous->month, 2)], 0, 3);
        } else {
            $smonth_name = substr($month[zeroise($previous->month, 2)], 0, 3);
        }
        $month_str = ereg_replace('%MONTH', $month[zeroise($previous->month, 2)], $wp_month_format);
        $month_str = ereg_replace('%YEAR', date('Y', mktime(0, 0, 0, $previous->month, 1, $previous->year)), $month_str);
        echo "\n\t\t" . '<td abbr="' . $month[zeroise($previous->month, 2)] . '" colspan="3" id="prev"><a href="' . get_month_link($previous->year, $previous->month) . '" title="View posts for ' . $month_str . '">&laquo; ' . $smonth_name . '</a></td>';
    } else {
        echo "\n\t\t" . '<td colspan="3" id="prev" class="pad">&nbsp;</td>';
    }
    echo "\n\t\t" . '<td class="pad">&nbsp;</td>';
    if ($next) {
        if (function_exists('mb_substr')) {
            $smonth_name = mb_substr($month[zeroise($next->month, 2)], 0, 3);
        } else {
            $smonth_name = substr($month[zeroise($next->month, 2)], 0, 3);
        }
        $month_str = ereg_replace('%MONTH', $month[zeroise($next->month, 2)], $wp_month_format);
        $month_str = ereg_replace('%YEAR', date('Y', mktime(0, 0, 0, $next->month, 1, $next->year)), $month_str);
        echo "\n\t\t" . '<td abbr="' . $month[zeroise($next->month, 2)] . '" colspan="3" id="next"><a href="' . get_month_link($next->year, $next->month) . '" title="View posts for ' . $month_str . '">' . $smonth_name . ' &raquo;</a></td>';
    } else {
        echo "\n\t\t" . '<td colspan="3" id="next" class="pad">&nbsp;</td>';
    }
    echo '
	</tr>
	</tfoot>

	<tbody>
	<tr>';
    // Get days with posts
    $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)\n\t\t\tFROM {$wpdb->posts[$wp_id]} WHERE MONTH(post_date) = {$thismonth}\n\t\t\tAND YEAR(post_date) = {$thisyear}\n\t\t\tAND post_status = 'publish'\n\t\t\tAND post_date < '" . date("Y-m-d H:i:s", time() + $time_difference * 3600) . "'", ARRAY_N);
    if ($dayswithposts) {
        foreach ($dayswithposts as $daywith) {
            $daywithpost[] = $daywith[0];
        }
    } else {
        $daywithpost = array();
    }
    if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE") || strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "camino") || strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "safari")) {
        $ak_title_separator = "\n";
    } else {
        $ak_title_separator = ", ";
    }
    $ak_titles_for_day = array();
    $ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH(post_date) as dom " . "FROM {$wpdb->posts[$wp_id]} " . "WHERE YEAR(post_date) = '{$thisyear}' " . "AND MONTH(post_date) = '{$thismonth}' " . "AND post_date < '" . date("Y-m-d H:i:s", time() + $time_difference * 3600) . "' " . "AND post_status = 'publish'");
    if ($ak_post_titles) {
        foreach ($ak_post_titles as $ak_post_title) {
            if (empty($ak_titles_for_day["day_" . $ak_post_title->dom])) {
                $ak_titles_for_day["day_" . $ak_post_title->dom] = '';
            }
            if (empty($ak_titles_for_day["{$ak_post_title->dom}"])) {
                // first one
                $ak_titles_for_day["{$ak_post_title->dom}"] = htmlspecialchars(stripslashes($ak_post_title->post_title));
            } else {
                $ak_titles_for_day["{$ak_post_title->dom}"] .= $ak_title_separator . htmlspecialchars(stripslashes($ak_post_title->post_title));
            }
        }
    }
    // See how much we should pad in the beginning
    $pad = intval(date('w', $unixmonth));
    if (0 != $pad) {
        echo "\n\t\t<td colspan='{$pad}' class='pad'>&nbsp;</td>";
    }
    $daysinmonth = intval(date('t', $unixmonth));
    for ($day = 1; $day <= $daysinmonth; ++$day) {
        if (isset($newrow) && $newrow) {
            echo "\n\t</tr>\n\t<tr>\n\t\t";
        }
        $newrow = false;
        if ($day == date('j', time() + $time_difference * 3600) && $thismonth == date('m', time() + $time_difference * 3600)) {
            echo '<td id="today">';
        } else {
            echo "<td>";
        }
        if (in_array($day, $daywithpost)) {
            // any posts today?
            echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"{$ak_titles_for_day[$day]}\">{$day}</a>";
        } else {
            echo $day;
        }
        echo '</td>';
        if (6 == date('w', mktime(0, 0, 0, $thismonth, $day, $thisyear))) {
            $newrow = true;
        }
    }
    $pad = 7 - date('w', mktime(0, 0, 0, $thismonth, $day, $thisyear));
    if ($pad != 0 && $pad != 7) {
        echo "\n\t\t<td class='pad' colspan='{$pad}'>&nbsp;</td>";
    }
    echo "\n\t</tr>\n\t</tbody>\n\t</table>";
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:101,代码来源:template-functions-general.php


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