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

PHP get_year_link函数代码示例

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

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



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

示例1: setUp

 function setUp()
 {
     parent::setUp();
     $this->month_url = get_month_link(date('Y'), date('m'));
     $this->year_url = get_year_link(date('Y'));
     $this->post_ids = $this->factory->post->create_many(8, array('post_type' => 'post', 'post_author' => '1'));
 }
开发者ID:boonebgorges,项目名称:wp,代码行数:7,代码来源:getArchives.php


示例2: test_page_type_notfound

 public function test_page_type_notfound()
 {
     $this->go_to('?name=' . rand_str());
     $this->assertTrue(is_404());
     $this->assertSame('notfound', Ad_Layers::instance()->get_current_page_type());
     $this->go_to(get_year_link('2025'));
     $this->assertTrue(is_404());
     $this->assertSame('notfound', Ad_Layers::instance()->get_current_page_type());
 }
开发者ID:statnews,项目名称:ad-layers,代码行数:9,代码来源:test-page-types.php


示例3: output_html

 /**
  * This checks on which page we're and display the correct breancrumb navigation
  * @return string | void
  */
 public function output_html()
 {
     global $post, $cat, $wp_query;
     $output = '';
     $arc_year = get_the_time('Y');
     $arc_month = get_the_time('F');
     $arc_day = get_the_time('d');
     $arc_day_full = get_the_time('l');
     $url_year = get_year_link($arc_year);
     $url_month = get_month_link($arc_year, $arc_month);
     $templates = array_keys(fw_get_db_ext_settings_option('ns-breadcrumb', 'hide-bdb-templates', array()));
     $types = array_keys(fw_get_db_ext_settings_option('ns-breadcrumb', 'hide-bdb-types', array()));
     if (in_array(get_post_type(), $types)) {
         return;
     }
     if (!is_front_page()) {
         //breadcrumb for single post
         if (is_single() && !in_array('single', $templates)) {
             $output = $this->is_single_post();
         } elseif (is_category() && !in_array('category', $templates)) {
             $output = '<li>' . $this->set_opt('category') . get_category_parents($cat, true, ' &raquo; ') . '</li>';
         } elseif (is_tax() && !in_array('category', $templates)) {
             $term = $wp_query->queried_object;
             $output = '<li>' . $this->set_opt('category') . $term->name . '</li>';
         } elseif (is_tag() && !in_array('tag', $templates)) {
             $output = '<li>' . $this->set_opt('tags') . single_tag_title('', false) . '</li>';
         } elseif (is_day() && !in_array('archive', $templates)) {
             $output = '<li><a href="' . $url_year . '">' . $arc_year . '</a></li>';
             $output .= '<li><a href="' . $url_month . '">' . $arc_month . '</a></li><li>' . $arc_day . ' (' . $arc_day_full . ')</li>';
         } elseif (is_month() && !in_array('archive', $templates)) {
             $output = '<li><a href="' . $url_year . '">' . $arc_year . '</a></li><li>' . $arc_month . '</li>';
         } elseif (is_year() && !in_array('archive', $templates)) {
             $output = '<li>' . $arc_year . '</li>';
         } elseif (is_search() && !in_array('search', $templates)) {
             $output = '<li>' . $this->set_opt('search') . get_search_query() . '</li>';
         } elseif (is_page() && !$post->post_parent && !in_array('page', $templates)) {
             $output = '<li>' . get_the_title() . '</li>';
         } elseif (is_page() && $post->post_parent && !in_array('page', $templates)) {
             $output = $this->is_page_n_has_parent();
         } elseif (is_author() && !in_array('author', $templates)) {
             global $author;
             $user_info = get_userdata($author);
             $output = '<li>' . $this->set_opt('author') . $user_info->display_name . '</li>';
         } elseif (is_404() && !in_array('404', $templates)) {
             $output = '<li>' . $this->set_opt('error') . '</li>';
         } else {
             //All other cases no Breadcrumb trail.
         }
     }
     if (!empty($output)) {
         $return = '<ul class="breadcrumb">';
         $return .= $this->set_opt('el_prefix');
         $return .= $output;
         $return .= '</ul>';
         echo $return;
     }
 }
开发者ID:nego-solutions,项目名称:ns-breadcrumb,代码行数:61,代码来源:class-fw-extension-ns-breadcrumb.php


示例4: elder_linkable_date

/**
 * Prints the date for a post with the month + date linkable to the moth archive and the year linked to the yearly archive
 * Date looks like - "September 21, 2014"
 */
function elder_linkable_date()
{
    global $year, $currentmonth;
    printf('<a href="%1$s" title="View posts from %2$s %3$s">', get_month_link($year, $currentmonth), get_the_date('F'), get_the_date('Y'));
    echo get_the_date('F') . ' ' . get_the_date('j');
    echo '</a>, ';
    printf('<a href="%1$s" title="View posts from %2$s">', get_year_link($year), get_the_date('Y'));
    echo get_the_date('Y');
    echo '</a>';
}
开发者ID:stefbowerman,项目名称:elder-journal-vs,代码行数:14,代码来源:functions.php


示例5: widget

    function widget($args, $instance)
    {
        extract($args);
        echo $before_widget;
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives', 'better-archives-widget') : $instance['title'], $instance, $this->id_base);
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        // years - months
        global $wpdb;
        $prevYear = '';
        $currentYear = '';
        if ($months = $wpdb->get_results("SELECT DISTINCT DATE_FORMAT(post_date, '%b') AS month , MONTH(post_date) as numMonth, YEAR( post_date ) AS year, COUNT( id ) as post_count FROM {$wpdb->posts} WHERE post_status = 'publish' and post_date <= now() and post_type = 'post' GROUP BY month , year ORDER BY post_date DESC")) {
            echo '<ul>';
            foreach ($months as $month) {
                $currentYear = $month->year;
                if ($currentYear !== $prevYear && '' !== $prevYear) {
                    echo '</ul></li>';
                }
                if ($currentYear !== $prevYear) {
                    ?>
					<li class="baw-year">
					<a href="<?php 
                    echo esc_url(get_year_link($month->year));
                    ?>
"><?php 
                    echo esc_html($month->year);
                    ?>
</a>
					<ul class="baw-months">
					<?php 
                }
                ?>
				<li class="baw-month">
					<a href="<?php 
                echo esc_url(get_month_link($month->year, $month->numMonth));
                ?>
"><?php 
                echo esc_html($month->month . ' ' . $month->year);
                ?>
</a>
				</li>
				<?php 
                $prevYear = $month->year;
            }
        }
        ?>
		</ul></li>
		<?php 
        echo '</ul>';
        echo $after_widget;
    }
开发者ID:oguzhank77,项目名称:better-archives-widget,代码行数:52,代码来源:widget-archives.php


示例6: __construct

 /**
  *
  */
 public function __construct()
 {
     global $post;
     $this->init_args();
     // Don't display on homepage
     if (is_front_page()) {
         return;
     }
     $this->add_crumb('Home', home_url());
     // Blog page
     if (is_home() || is_singular('post')) {
         $this->add_crumb('Blog', get_permalink(get_option('page_for_posts')));
     }
     if (is_archive()) {
         $this->add_post_type_crumb();
     }
     if (is_category()) {
         $category = current(get_the_category());
         $this->add_crumb($category->name, get_category_link($category));
     } elseif (is_single()) {
         $this->add_post_type_crumb();
         $this->add_current_crumb();
     } elseif (is_page()) {
         if ($post->post_parent) {
             $ancestors = get_post_ancestors($post->ID);
             $ancestors = array_reverse($ancestors);
             foreach ($ancestors as $ancestor) {
                 $this->add_crumb(get_the_title($ancestor), get_permalink($ancestor));
             }
         }
         $this->add_current_crumb();
     } elseif (is_tag()) {
         //single_tag_title();
     } elseif (is_tax()) {
         $this->add_crumb(framework_get_queried_object_title());
     } elseif (is_day()) {
         //echo "<li>Archive for "; the_time('F jS, Y'); echo'</li>';
     } elseif (is_month()) {
         $this->add_crumb(get_the_time('Y'), get_year_link(get_the_time('Y')));
         $this->add_crumb(get_the_time('F'));
     } elseif (is_year()) {
         $this->add_crumb(get_the_time('Y'));
     } elseif (is_author()) {
         $this->add_crumb(get_the_author(), false);
     } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
         //echo "<li>Blog Archives"; echo'</li>';
     } elseif (is_search()) {
         //echo "<li>Search Results"; echo'</li>';
     }
 }
开发者ID:sube1even,项目名称:azWCtYsMP34bXs,代码行数:53,代码来源:breadcrumbs.php


示例7: generate_data

    protected function generate_data()
    {
        global $wpdb;
        $requested = $this->requested;
        if ('monthly' == $requested) {
            $latest_post_query = '
				SELECT
					YEAR(post_date) as year,
					MONTH(post_date) as month,
					MAX(post_modified) as post_modified,
					MAX(post_modified_gmt) as post_modified_gmt,
					MAX(comment_count) as comment_count
				FROM ' . $wpdb->posts . "\n\t\t\t\tWHERE post_status = 'publish'\n\t\t\t\t\tAND post_password = ''\n\t\t\t\t\tAND post_type = 'post'" . '
				GROUP BY year, month
				ORDER BY post_modified DESC';
        } else {
            $latest_post_query = '
				SELECT
					YEAR(post_date) as year,
					MAX(post_modified) as post_modified,
					MAX(post_modified_gmt) as post_modified_gmt,
					MAX(comment_count) as comment_count
				FROM ' . $wpdb->posts . "\n\t\t\t\tWHERE post_status = 'publish'\n\t\t\t\t\tAND post_password = ''\n\t\t\t\t\tAND post_type <> 'page'" . '
				GROUP BY year
				ORDER BY post_modified DESC';
        }
        $latest_posts = $this->get_results($latest_post_query);
        if (!isset($latest_posts) || 0 == sizeof($latest_posts)) {
            return false;
        }
        $data = array();
        for ($i = 0; $i < sizeof($latest_posts); $i++) {
            $post = $latest_posts[$i];
            $data = $this->init_data($data);
            if ('monthly' == $requested) {
                $data['location'] = get_month_link($post->year, $post->month);
            } else {
                if ('yearly' == $requested) {
                    $data['location'] = get_year_link($post->year);
                }
            }
            $data['lastmod'] = $this->get_lastmod($post);
            $data['freq'] = $this->cal_frequency($post);
            $data['priority'] = $this->cal_priority($post, $data['freq']);
            $this->data[] = $data;
        }
        unset($latest_posts);
        return true;
    }
开发者ID:ashenkar,项目名称:sanga,代码行数:49,代码来源:archive.php


示例8: get_breadcrumbs

function get_breadcrumbs()
{
    global $wp_query;
    $breadcrumbs = "";
    if (!is_home()) {
        $breadcrumbs .= '<li><a title="' . get_bloginfo('name') . '" href="' . get_settings('home') . '">' . get_bloginfo('name') . '</a></li>';
        if (is_category()) {
            $catTitle = single_cat_title("", false);
            $cat = get_cat_ID($catTitle);
            $breadcrumbs .= "<li>" . get_category_parents($cat, true, "") . "</li>";
        } elseif (is_archive() && !is_category()) {
            $y = get_query_var('year');
            $m = get_query_var('monthnum');
            if (is_year()) {
                $breadcrumbs .= "<li>" . $y . "年</li>";
            }
            if (is_month()) {
                $breadcrumbs .= '<li><a title="' . $y . '年" href="' . get_year_link($y) . '">' . $y . '年</a></li>';
                $breadcrumbs .= "<li>" . $m . "月</li>";
            }
        } elseif (is_search()) {
            $breadcrumbs .= "<li>Search Results</li>";
        } elseif (is_404()) {
            $breadcrumbs .= "<li>404 Not Found</li>";
        } elseif (is_single()) {
            $category = get_the_category();
            $category_id = get_cat_ID($category[0]->cat_name);
            $breadcrumbs .= '<li>' . get_category_parents($category_id, true, "") . "</li>";
            $breadcrumbs .= '<li>' . get_the_title(get_query_var('p')) . "</li>";
        } elseif (is_page()) {
            $post = $wp_query->get_queried_object();
            if ($post->post_parent == 0) {
                $breadcrumbs .= "<li>" . the_title('', '', false) . "</li>";
            } else {
                $title = the_title('', '', false);
                $ancestors = array_reverse(get_post_ancestors($post->ID));
                array_push($ancestors, $post->ID);
                foreach ($ancestors as $ancestor) {
                    if ($ancestor != end($ancestors)) {
                        $breadcrumbs .= '<li><a href="' . get_permalink($ancestor) . '">' . strip_tags(apply_filters('single_post_title', get_the_title($ancestor))) . '</a></li>';
                    } else {
                        $breadcrumbs .= '<li>' . strip_tags(apply_filters('single_post_title', get_the_title($ancestor))) . '</li>';
                    }
                }
            }
        }
    }
    return $breadcrumbs;
}
开发者ID:holyshared,项目名称:mootips,代码行数:49,代码来源:functions.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: _checkFile

 function _checkFile($directory, $file)
 {
     $f = "{$directory}/{$file}";
     if (ctype_digit($file)) {
         if ($this->_directory === $directory) {
             // add year to the list (do not closes li, because
             // we may have nested elements)
             $this->_year = $file;
             $lnk = get_year_link($file);
             $this->_htmllist[$this->_year] = "<li class=\"archive-year archive-y20{$file}\"> <a href=\"{$lnk}\">20{$file}</a>";
             return 1;
         } elseif (is_dir($f)) {
             $this->_months[] = $file;
             return 0;
         }
     }
 }
开发者ID:mroussel,项目名称:flatpress,代码行数:17,代码来源:plugin.archives.php


示例11: get_items_yearly

 /**
  * @param array|string $args
  * @param string $last_changed
  * @param string $join
  * @param string $where
  * @param string $order
  * @param string $limit
  * @return array
  */
 function get_items_yearly($args, $last_changed, $join, $where, $order, $limit)
 {
     global $wpdb;
     $output = array();
     $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM {$wpdb->posts} {$join} {$where} GROUP BY YEAR(post_date) ORDER BY post_date {$order} {$limit}";
     $key = md5($query);
     $key = "wp_get_archives:{$key}:{$last_changed}";
     if (!($results = wp_cache_get($key, 'posts'))) {
         $results = $wpdb->get_results($query);
         wp_cache_set($key, $results, 'posts');
     }
     if ($results) {
         foreach ((array) $results as $result) {
             $url = get_year_link($result->year);
             $text = sprintf('%d', $result->year);
             $output[] = $this->get_archives_link($url, $text);
         }
     }
     return $output;
 }
开发者ID:aauroux,项目名称:timber,代码行数:29,代码来源:timber-archives.php


示例12: flush_post


//.........这里部分代码省略.........
             for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
                 $day_pagenum_link = $this->_get_pagenum_link($day_uri, $pagenum);
                 $day_pagenum_uri = str_replace($domain_url, '', $day_pagenum_link);
                 $uris[] = $day_pagenum_uri;
             }
         }
         /**
          * Monthly archive URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.archive.monthly') && $post) {
             $post_date = strtotime($post->post_date);
             $post_year = gmdate('Y', $post_date);
             $post_month = gmdate('m', $post_date);
             $posts_per_page = get_option('posts_per_page');
             $posts_number = $this->_get_archive_posts_count($post_year, $post_month);
             $posts_pages_number = @ceil($posts_number / $posts_per_page);
             $month_link = get_month_link($post_year, $post_month);
             $month_uri = str_replace($domain_url, '', $month_link);
             for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
                 $month_pagenum_link = $this->_get_pagenum_link($month_uri, $pagenum);
                 $month_pagenum_uri = str_replace($domain_url, '', $month_pagenum_link);
                 $uris[] = $month_pagenum_uri;
             }
         }
         /**
          * Yearly archive URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.archive.yearly') && $post) {
             $post_date = strtotime($post->post_date);
             $post_year = gmdate('Y', $post_date);
             $posts_per_page = get_option('posts_per_page');
             $posts_number = $this->_get_archive_posts_count($post_year);
             $posts_pages_number = @ceil($posts_number / $posts_per_page);
             $year_link = get_year_link($post_year);
             $year_uri = str_replace($domain_url, '', $year_link);
             for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
                 $year_pagenum_link = $this->_get_pagenum_link($year_uri, $pagenum);
                 $year_pagenum_uri = str_replace($domain_url, '', $year_pagenum_link);
                 $uris[] = $year_pagenum_uri;
             }
         }
         /**
          * Feed URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.feed.blog')) {
             foreach ($feeds as $feed) {
                 $feed_link = get_feed_link($feed);
                 $feed_uri = str_replace($domain_url, '', $feed_link);
                 $uris[] = $feed_uri;
             }
         }
         if ($this->_config->get_boolean('pgcache.purge.feed.comments')) {
             foreach ($feeds as $feed) {
                 $post_comments_feed_link = get_post_comments_feed_link($post_id, $feed);
                 $post_comments_feed_uri = str_replace($domain_url, '', $post_comments_feed_link);
                 $uris[] = $post_comments_feed_uri;
             }
         }
         if ($this->_config->get_boolean('pgcache.purge.feed.author') && $post) {
             foreach ($feeds as $feed) {
                 $author_feed_link = get_author_feed_link($post->post_author, $feed);
                 $author_feed_uri = str_replace($domain_url, '', $author_feed_link);
                 $uris[] = $author_feed_uri;
             }
         }
         if ($this->_config->get_boolean('pgcache.purge.feed.terms')) {
开发者ID:nxtclass,项目名称:NXTClass,代码行数:67,代码来源:PgCacheFlush.php


示例13: foundationpress_breadcrumb

 function foundationpress_breadcrumb($showhome = true, $separatorclass = false)
 {
     // Settings
     $separator = '&gt;';
     $id = 'breadcrumbs';
     $class = 'breadcrumbs';
     $home_title = 'Homepage';
     // Get the query & post information
     global $post, $wp_query;
     $category = get_the_category();
     // Build the breadcrums
     echo '<ul id="' . $id . '" class="' . $class . '">';
     // Do not display on the homepage
     if (!is_front_page()) {
         // Home page
         echo '<li class="item-home"><a class="bread-link bread-home" href="' . get_home_url() . '" title="' . $home_title . '">' . $home_title . '</a></li>';
         if ($separatorclass) {
             echo '<li class="separator separator-home"> ' . $separator . ' </li>';
         }
         if (is_single()) {
             // Single post (Only display the first category)
             echo '<li class="item-cat item-cat-' . $category[0]->term_id . ' item-cat-' . $category[0]->category_nicename . '"><a class="bread-cat bread-cat-' . $category[0]->term_id . ' bread-cat-' . $category[0]->category_nicename . '" href="' . get_category_link($category[0]->term_id) . '" title="' . $category[0]->cat_name . '">' . $category[0]->cat_name . '</a></li>';
             if ($separatorclass) {
                 echo '<li class="separator separator-' . $category[0]->term_id . '"> ' . $separator . ' </li>';
             }
             echo '<li class="item-current item-' . $post->ID . '"><strong class="bread-current bread-' . $post->ID . '" title="' . get_the_title() . '">' . get_the_title() . '</strong></li>';
         } else {
             if (is_category()) {
                 // Category page
                 echo '<li class="item-current item-cat-' . $category[0]->term_id . ' item-cat-' . $category[0]->category_nicename . '"><strong class="bread-current bread-cat-' . $category[0]->term_id . ' bread-cat-' . $category[0]->category_nicename . '">' . $category[0]->cat_name . '</strong></li>';
             } else {
                 if (is_page()) {
                     // Standard page
                     if ($post->post_parent) {
                         // If child page, get parents
                         $anc = get_post_ancestors($post->ID);
                         // Get parents in the right order
                         $anc = array_reverse($anc);
                         // Parent page loop
                         $parents = '';
                         foreach ($anc as $ancestor) {
                             $parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . get_permalink($ancestor) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
                             if ($separatorclass) {
                                 $parents .= '<li class="separator separator-' . $ancestor . '"> ' . $separator . ' </li>';
                             }
                         }
                         // Display parent pages
                         echo $parents;
                         // Current page
                         echo '<li class="current item-' . $post->ID . '">' . get_the_title() . '</li>';
                     } else {
                         // Just display current page if not parents
                         echo '<li class="current item-' . $post->ID . '"> ' . get_the_title() . '</li>';
                     }
                 } else {
                     if (is_tag()) {
                         // Tag page
                         // Get tag information
                         $term_id = get_query_var('tag_id');
                         $taxonomy = 'post_tag';
                         $args = 'include=' . $term_id;
                         $terms = get_terms($taxonomy, $args);
                         // Display the tag name
                         echo '<li class="current item-tag-' . $terms[0]->term_id . ' item-tag-' . $terms[0]->slug . '">' . $terms[0]->name . '</li>';
                     } elseif (is_day()) {
                         // Day archive
                         // Year link
                         echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
                         if ($separatorclass) {
                             echo '<li class="separator separator-' . get_the_time('Y') . '"> ' . $separator . ' </li>';
                         }
                         // Month link
                         echo '<li class="item-month item-month-' . get_the_time('m') . '"><a class="bread-month bread-month-' . get_the_time('m') . '" href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '" title="' . get_the_time('M') . '">' . get_the_time('M') . ' Archives</a></li>';
                         if ($separatorclass) {
                             echo '<li class="separator separator-' . get_the_time('m') . '"> ' . $separator . ' </li>';
                         }
                         // Day display
                         echo '<li class="current item-' . get_the_time('j') . '">' . get_the_time('jS') . ' ' . get_the_time('M') . ' Archives</li>';
                     } else {
                         if (is_month()) {
                             // Month Archive
                             // Year link
                             echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
                             if ($separatorclass) {
                                 echo '<li class="separator separator-' . get_the_time('Y') . '"> ' . $separator . ' </li>';
                             }
                             // Month display
                             echo '<li class="item-month item-month-' . get_the_time('m') . '">' . get_the_time('M') . ' Archives</li>';
                         } else {
                             if (is_year()) {
                                 // Display year archive
                                 echo '<li class="current item-current-' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</li>';
                             } else {
                                 if (is_author()) {
                                     // Auhor archive
                                     // Get the author information
                                     global $author;
                                     $userdata = get_userdata($author);
                                     // Display author name
                                     echo '<li class="current item-current-' . $userdata->user_nicename . '">Author: ' . $userdata->display_name . '</li>';
//.........这里部分代码省略.........
开发者ID:felipegenuino,项目名称:rtaonline-novo,代码行数:101,代码来源:navigation.php


示例14: odin_breadcrumbs


//.........这里部分代码省略.........
            $category = $category[0];
            echo '<li><a href="' . get_category_link($category->term_id) . '">' . $category->name . '</a></li>';
            echo '<li><a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a></li>';
            echo $current_before . get_the_title() . $current_after;
            // Page without parents.
        } elseif (is_page() && !$post->post_parent) {
            echo $current_before . get_the_title() . $current_after;
            // Page with parents.
        } elseif (is_page() && $post->post_parent) {
            $parent_id = $post->post_parent;
            $breadcrumbs = array();
            while ($parent_id) {
                $page = get_page($parent_id);
                $breadcrumbs[] = '<li><a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a></li>';
                $parent_id = $page->post_parent;
            }
            $breadcrumbs = array_reverse($breadcrumbs);
            foreach ($breadcrumbs as $crumb) {
                echo $crumb . ' ';
            }
            echo $current_before . get_the_title() . $current_after;
            // Category archive.
        } elseif (is_category()) {
            $category_object = $wp_query->get_queried_object();
            $category_id = $category_object->term_id;
            $current_category = get_category($category_id);
            $parent_category = get_category($current_category->parent);
            // Displays parent category.
            if (0 != $current_category->parent) {
                $parents = get_category_parents($parent_category, TRUE, false);
                $parents = str_replace('<a', '<li><a', $parents);
                $parents = str_replace('</a>', '</a></li>', $parents);
                echo $parents;
            }
            printf(__('%sCategory: %s%s', 'odin'), $current_before, single_cat_title('', false), $current_after);
            // Tags archive.
        } elseif (is_tag()) {
            printf(__('%sTag: %s%s', 'odin'), $current_before, single_tag_title('', false), $current_after);
            // Custom post type archive.
        } elseif (is_post_type_archive()) {
            // Check if Woocommerce Shop
            if (is_woocommerce_activated() && is_shop()) {
                $shop_page_id = wc_get_page_id('shop');
                echo $current_before . get_the_title($shop_page_id) . $current_after;
            } else {
                echo $current_before . post_type_archive_title('', false) . $current_after;
            }
            // Search page.
        } elseif (is_search()) {
            printf(__('%sSearch result for: &quot;%s&quot;%s', 'odin'), $current_before, get_search_query(), $current_after);
            // Author archive.
        } elseif (is_author()) {
            $userdata = get_userdata($author);
            echo $current_before . __('Posted by', 'odin') . ' ' . $userdata->display_name . $current_after;
            // Archives per days.
        } elseif (is_day()) {
            echo '<li><a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a></li>';
            echo '<li><a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a></li>';
            echo $current_before . get_the_time('d') . $current_after;
            // Archives per month.
        } elseif (is_month()) {
            echo '<li><a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a></li>';
            echo $current_before . get_the_time('F') . $current_after;
            // Archives per year.
        } elseif (is_year()) {
            echo $current_before . get_the_time('Y') . $current_after;
            // Archive fallback for custom taxonomies.
        } elseif (is_archive()) {
            $current_object = $wp_query->get_queried_object();
            $taxonomy = get_taxonomy($current_object->taxonomy);
            $term_name = $current_object->name;
            // Displays the post type that the taxonomy belongs.
            if (!empty($taxonomy->object_type)) {
                // Get correct Woocommerce Post Type crumb
                if (is_woocommerce()) {
                    $shop_page = get_post(wc_get_page_id('shop'));
                    echo '<li><a href="' . get_permalink($shop_page) . '">' . get_the_title($shop_page) . '</a></li>';
                } else {
                    $_post_type = array_shift($taxonomy->object_type);
                    $post_type = get_post_type_object($_post_type);
                    echo '<li><a href="' . get_post_type_archive_link($post_type->name) . '">' . $post_type->label . '</a></li> ';
                }
            }
            // Displays parent term.
            if (0 != $current_object->parent) {
                $parent_term = get_term($current_object->parent, $current_object->taxonomy);
                echo '<li><a href="' . get_term_link($parent_term) . '">' . $parent_term->name . '</a></li>';
            }
            echo $current_before . $taxonomy->label . ': ' . $term_name . $current_after;
            // 404 page.
        } elseif (is_404()) {
            echo $current_before . __('404 Error', 'odin') . $current_after;
        }
        // Gets pagination.
        if (get_query_var('paged')) {
            echo ' (' . sprintf(__('Page %s', 'abelman'), get_query_var('paged')) . ')';
        }
        echo '</ol>';
    }
}
开发者ID:trfiladelfo,项目名称:odin,代码行数:101,代码来源:helpers.php


示例15: do_archive_by_date

 /**
  * A Breadcrumb Trail Filling Function
  * 
  * This functions fills a breadcrumb for a date archive.
  *
  */
 protected function do_archive_by_date()
 {
     global $wp_query;
     //First deal with the day breadcrumb
     if (is_day() || is_single()) {
         //Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
         $breadcrumb = $this->add(new bcn_breadcrumb(get_the_time('d'), $this->opt['Hdate_template_no_anchor'], array('archive', 'date-day')));
         //If this is a day archive, add current-item type
         if (is_day()) {
             $breadcrumb->add_type('current-item');
         }
         //If we're paged, let's link to the first page
         if ($this->opt['bcurrent_item_linked'] || is_paged() && $this->opt['bpaged_display'] || is_single()) {
             //We're linking, so set the linked template
             $breadcrumb->set_template($this->opt['Hdate_template']);
             //Deal with the anchor
             $breadcrumb->set_url(get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d')));
         }
     }
     //Now deal with the month breadcrumb
     if (is_month() || is_day() || is_single()) {
         //Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
         $breadcrumb = $this->add(new bcn_breadcrumb(get_the_time('F'), $this->opt['Hdate_template_no_anchor'], array('archive', 'date-month')));
         //If this is a month archive, add current-item type
         if (is_month()) {
             $breadcrumb->add_type('current-item');
         }
         //If we're paged, or not in the archive by month let's link to the first archive by month page
         if ($this->opt['bcurrent_item_linked'] || is_day() || is_single() || is_month() && is_paged() && $this->opt['bpaged_display']) {
             //We're linking, so set the linked template
             $breadcrumb->set_template($this->opt['Hdate_template']);
             //Deal with the anchor
             $breadcrumb->set_url(get_month_link(get_the_time('Y'), get_the_time('m')));
         }
     }
     //Place the year breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return
     $breadcrumb = $this->add(new bcn_breadcrumb(get_the_time('Y'), $this->opt['Hdate_template_no_anchor'], array('archive', 'date-year')));
     //If this is a year archive, add current-item type
     if (is_year()) {
         $breadcrumb->add_type('current-item');
     }
     //If we're paged, or not in the archive by year let's link to the first archive by year page
     if ($this->opt['bcurrent_item_linked'] || is_day() || is_month() || is_single() || is_paged() && $this->opt['bpaged_display']) {
         //We're linking, so set the linked template
         $breadcrumb->set_template($this->opt['Hdate_template']);
         //Deal with the anchor
         $breadcrumb->set_url(get_year_link(get_the_time('Y')));
     }
 }
开发者ID:pablomarsan,项目名称:iftheme-docs,代码行数:55,代码来源:class.bcn_breadcrumb_trail.php


示例16: redirect_canonical


//.........这里部分代码省略.........
    } elseif (is_object($wp_rewrite) && $wp_rewrite->using_permalinks()) {
        // rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101
        if (is_attachment() && !empty($_GET['attachment_id']) && !$redirect_url) {
            if ($redirect_url = get_attachment_link(get_query_var('attachment_id'))) {
                $redirect['query'] = remove_query_arg('attachment_id', $redirect['query']);
            }
        } elseif (is_single() && !empty($_GET['p']) && !$redirect_url) {
            if ($redirect_url = get_permalink(get_query_var('p'))) {
                $redirect['query'] = remove_query_arg(array('p', 'post_type'), $redirect['query']);
            }
            if (get_query_var('page')) {
                $redirect_url = trailingslashit($redirect_url) . user_trailingslashit(get_query_var('page'), 'single_paged');
                $redirect['query'] = remove_query_arg('page', $redirect['query']);
            }
        } elseif (is_single() && !empty($_GET['name']) && !$redirect_url) {
            if ($redirect_url = get_permalink($wp_query->get_queried_object_id())) {
                $redirect['query'] = remove_query_arg('name', $redirect['query']);
            }
        } elseif (is_page() && !empty($_GET['page_id']) && !$redirect_url) {
            if ($redirect_url = get_permalink(get_query_var('page_id'))) {
                $redirect['query'] = remove_query_arg('page_id', $redirect['query']);
            }
        } elseif (is_page() && !is_feed() && isset($wp_query->queried_object) && 'page' == get_option('show_on_front') && $wp_query->queried_object->ID == get_option('page_on_front') && !$redirect_url) {
            $redirect_url = home_url('/');
        } elseif (is_home() && !empty($_GET['page_id']) && 'page' == get_option('show_on_front') && get_query_var('page_id') == get_option('page_for_posts') && !$redirect_url) {
            if ($redirect_url = get_permalink(get_option('page_for_posts'))) {
                $redirect['query'] = remove_query_arg('page_id', $redirect['query']);
            }
        } elseif (!empty($_GET['m']) && (is_year() || is_month() || is_day())) {
            $m = get_query_var('m');
            switch (strlen($m)) {
                case 4:
                    // Yearly
                    $redirect_url = get_year_link($m);
                    break;
                case 6:
                    // Monthly
                    $redirect_url = get_month_link(substr($m, 0, 4), substr($m, 4, 2));
                    break;
                case 8:
                    // Daily
                    $redirect_url = get_day_link(substr($m, 0, 4), substr($m, 4, 2), substr($m, 6, 2));
                    break;
            }
            if ($redirect_url) {
                $redirect['query'] = remove_query_arg('m', $redirect['query']);
            }
            // now moving on to non ?m=X year/month/day links
        } elseif (is_day() && get_query_var('year') && get_query_var('monthnum') && !empty($_GET['day'])) {
            if ($redirect_url = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day'))) {
                $redirect['query'] = remove_query_arg(array('year', 'monthnum', 'day'), $redirect['query']);
            }
        } elseif (is_month() && get_query_var('year') && !empty($_GET['monthnum'])) {
            if ($redirect_url = get_month_link(get_query_var('year'), get_query_var('monthnum'))) {
                $redirect['query'] = remove_query_arg(array('year', 'monthnum'), $redirect['query']);
            }
        } elseif (is_year() && !empty($_GET['year'])) {
            if ($redirect_url = get_year_link(get_query_var('year'))) {
                $redirect['query'] = remove_query_arg('year', $redirect['query']);
            }
        } elseif (is_author() && !empty($_GET['author']) && preg_match('|^[0-9]+$|', $_GET['author'])) {
            $author = get_userdata(get_query_var('author'));
            if (false !== $author && ($redirect_url = get_author_posts_url($author->ID, $author->user_nicename))) {
                $redirect['query'] = remove_query_arg('author', $redirect['query']);
            }
        } elseif (is_category() || is_tag() || is_tax()) {
开发者ID:laiello,项目名称:cartonbank,代码行数:67,代码来源:canonical.php


示例17: dimox_breadcrumbs


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_yoil函数代码示例发布时间:2022-05-15
下一篇:
PHP get_yahoo_rt_quote函数代码示例发布时间: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