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

PHP the_permalink函数代码示例

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

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



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

示例1: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $post_number = $instance['post_number'];
        echo $before_widget;
        echo $before_title . $title . $after_title;
        $random_query = new WP_Query('posts_per_page=' . $post_number . '&orderby=rand');
        if ($random_query->have_posts()) {
            echo "<ol>";
            while ($random_query->have_posts()) {
                $random_query->the_post();
                ?>
 
                <li><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></li>
 
            <?php 
            }
            echo "</ol>";
        }
        echo $after_widget;
    }
开发者ID:anhqui,项目名称:RANDPOST_WIDGET,代码行数:31,代码来源:rand_post.php


示例2: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $number = $instance['number'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        echo '<ul>';
        query_posts(array('post_type' => 'portfolio', 'showposts' => $number));
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>
				
				<li>
					<a href="<?php 
                the_permalink();
                ?>
">
						<?php 
                the_post_thumbnail('portfolio');
                ?>
					</a>
				</li>
				
				<?php 
            }
        }
        wp_reset_query();
        echo '</ul>';
        echo $after_widget;
    }
开发者ID:aliciahurst,项目名称:cowboy-bear-ninja,代码行数:34,代码来源:widget-recent-projects.php


示例3: my_facebook_tags

function my_facebook_tags()
{
    if (is_single()) {
        ?>
		<meta property="og:title" content="<?php 
        the_title();
        ?>
" />
		<meta property="og:site_name" content="<?php 
        bloginfo('name');
        ?>
" />
		<meta property="og:url" content="<?php 
        the_permalink();
        ?>
" />
		<meta property="og:description" content="<?php 
        the_excerpt();
        ?>
" />
		<meta property="og:type" content="article" />
<?php 
        if (has_post_thumbnail()) {
            $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
            ?>
<meta property="og:image" content="<?php 
            echo $image[0];
            ?>
" />
<?php 
        }
    }
}
开发者ID:hollandlive,项目名称:ivik,代码行数:33,代码来源:wp_plugin_my_facebook_tags.php


示例4: tpp_posts_widget

function tpp_posts_widget()
{
    $tpp_posts_query = new WP_Query(array('posts_per_page' => 10, 'orderby' => 'comment_count', 'order' => 'DESC', 'post__in' => get_option('sticky_posts')));
    ?>
	<h3><?php 
    _e('Posts on this page:');
    ?>
</h3>
	<?php 
    if ($tpp_posts_query->have_posts()) {
        while ($tpp_posts_query->have_posts()) {
            $tpp_posts_query->the_post();
            ?>
	<a href="<?php 
            echo the_permalink();
            ?>
"
		title="<?php 
            echo the_title();
            ?>
"><?php 
            echo the_title();
            ?>
</a>
		(<?php 
            echo comments_number();
            ?>
) <br />
	<?php 
        }
    }
    ?>
	<?php 
}
开发者ID:kirandash,项目名称:bijiplugindfly,代码行数:34,代码来源:top_posts_endStep1.php


示例5: widget

    function widget($args, $instance)
    {
        global $post, $wp_query;
        Protect();
        extract($args, EXTR_SKIP);
        $post_query = 'showposts=1&cat=' . $instance['thecat'];
        $posts =& query_posts($post_query);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                echo $before_widget;
                $title = empty($instance['title']) ? 'Latest Excerpt' : apply_filters('widget_title', $instance['title']);
                if (!empty($title)) {
                    echo $before_title . $title . $after_title;
                }
                ?>
				<ul>
					<li><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></li>
					<li><?php 
                the_excerpt();
                ?>
</li>
				</ul>
				<?php 
                echo $after_widget;
            }
        }
        UnProtect();
    }
开发者ID:besimhu,项目名称:legacy,代码行数:35,代码来源:latestexcerpt.php


示例6: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? 'From The Blog' : $instance['title']);
        $posts_number = empty($instance['posts_number']) ? '' : $instance['posts_number'];
        $blog_category = empty($instance['blog_category']) ? '' : $instance['blog_category'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
	
	<ul>
		<?php 
        query_posts("showposts=" . $posts_number . "&cat=" . $blog_category);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>
			<li><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></li>
		<?php 
            }
        }
        wp_reset_query();
        ?>
	</ul> <!-- end ul.nav -->
<?php 
        echo $after_widget;
    }
开发者ID:rogopag,项目名称:Chameleon,代码行数:35,代码来源:widget-fromblog.php


示例7: widget

        function widget($args, $instance)
        {
            // prints the widget
            extract($args, EXTR_SKIP);
            echo $before_widget;
            $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
            $category = empty($instance['category']) ? '' : apply_filters('widget_category', $instance['category']);
            $post_type = empty($instance['post_type']) ? 'post' : apply_filters('widget_post_type', $instance['post_type']);
            $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
            ?>
			<div class="featured_video">		
			<?php 
            if ($title) {
                ?>
<h3 class="clearfix"> <?php 
                echo $title;
                ?>
</h3><?php 
            }
            ?>
            <?php 
            global $post;
            $args = '';
            if ($category) {
                $args .= '&category=' . $category;
            }
            $latest_menus = get_posts('numberposts=' . $post_number . $args . '&post_type=' . $post_type);
            foreach ($latest_menus as $post) {
                setup_postdata($post);
                if (get_post_meta($post->ID, 'video', true) || get_post_meta($post->ID, 'Video', true) || get_post_meta($post->ID, 'VIDEO', true)) {
                    if (get_post_meta($post->ID, 'video', true)) {
                        $video = get_post_meta($post->ID, 'video', true);
                    } elseif (get_post_meta($post->ID, 'Video', true)) {
                        $video = get_post_meta($post->ID, 'Video', true);
                    } elseif (get_post_meta($post->ID, 'VIDEO', true)) {
                        $video = get_post_meta($post->ID, 'VIDEO', true);
                    }
                    ?>
                 <div class="video">
                <?php 
                    echo $video;
                    ?>
                    <h4><a class="widget-title" href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
 </a></h4>
                </div>
                <?php 
                }
                ?>
             <?php 
            }
            ?>
             </div>
            <?php 
            echo $after_widget;
        }
开发者ID:annguyenit,项目名称:getdeal,代码行数:60,代码来源:featured_video.php


示例8: widget

    function widget($args, $instance)
    {
        extract($args);
        @($title = $instance['title'] ? $instance['title'] : '最热文章');
        @($num = $instance['num'] ? $instance['num'] : 5);
        echo $before_widget;
        ?>
      <div class="panel panel-zan hidden-xs">
        <div class="panel-heading"><?php 
        echo $title;
        ?>
</div>
        <div class="panel-body">
          <ul class="list-group">
            <?php 
        // 设置全局变量,实现post整体赋值
        global $post;
        $posts = zan_get_hotest_posts($num);
        foreach ($posts as $post) {
            setup_postdata($post);
            ?>
              <li class="zan-list clearfix">
                <figure class="thumbnail zan-thumb">
                  <?php 
            the_post_thumbnail(array(75, 75));
            ?>
                </figure>
                <a href="<?php 
            the_permalink();
            ?>
">
                 <h5><?php 
            the_title();
            ?>
</h5>
                </a>
                <div class="sidebar-info">
                  <span><i class="fa fa-calendar"></i> <?php 
            the_time('m月j日, Y');
            ?>
</span>
                  <span><i class="fa fa-comment"></i> <a href="<?php 
            the_permalink();
            ?>
#comments"><?php 
            comments_number('0', '1', '%');
            ?>
</a></span>
                </div>
              </li>
            <?php 
        }
        wp_reset_postdata();
        ?>
          </ul>
        </div>
      </div>
    <?php 
        echo $after_widget;
    }
开发者ID:zhengxiexie,项目名称:wordpress,代码行数:60,代码来源:zan-widget-hotest-posts.php


示例9: widget

    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        echo $before_widget;
        $a = array("orderby" => "id", "order" => "asc");
        $categories = get_categories($a);
        foreach ($categories as $category) {
            echo $before_title;
            // var_dump($category);
            echo "<h2>" . $category->name . "</h2><ul>";
            global $post;
            $args = array('category' => $category->term_id, "numberposts" => -1, "orderby" => "title", "order" => "ASC");
            $myposts = get_posts($args);
            foreach ($myposts as $post) {
                setup_postdata($post);
                ?>
<li><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></li><?php 
            }
            echo "</ul>";
            wp_reset_query();
            echo $after_title;
        }
        echo $after_widget;
    }
开发者ID:besimhu,项目名称:legacy,代码行数:31,代码来源:all-posts-by-category.php


示例10: widget

    function widget($args, $instance)
    {
        extract($args);
        $countt = apply_filters('widget_guanzhu_sina', empty($instance['countt']) ? __('nothing') : $instance['countt']);
        //小工具前台标题
        echo $before_widget;
        echo '<i class="iconfont iconfont-siadebar">&#xe609</i>
					<h3 class="widget-title">
						热门文章
					</h3>
					<div class="widget-main widget-main-hot">
						<ul>';
        if (intval($countt) <= 10) {
            $popular = new WP_Query('orderby=comment_count&posts_per_page=' . $countt);
            $count_di = 1;
            while ($popular->have_posts()) {
                $popular->the_post();
                echo '<li><span>' . $count_di . '</span>' . '<a href="';
                the_permalink();
                echo '">';
                the_title();
                echo '</a></li>';
                $count_di++;
            }
        }
        echo '</ul>';
        echo '</div>';
        echo $after_widget;
    }
开发者ID:pemiu01,项目名称:WordPress_Theme_2m,代码行数:29,代码来源:hot_article.php


示例11: categori_news

        function categori_news(){
            query_posts('cat=9&showposts=10&posts_per_page=3');

            while (have_posts()) : the_post();
                /*Dima insert*/the_excerpt(); ?>
                <div class="content-box">
                    <div class="bgr01"><div class="bgr02"><div class="bgr03">
                                <div <?php post_class() ?> id="post-<?php the_ID(); ?>" style=" float:none; ">
                                    <div class="title">
                                        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                                        <div class="date_all">
                                            <?php the_time('l, j ?F, Y') ?>
                                        </div>
                                        <div class="post">
                                            Написал <?php the_author_link() ?> <?php the_time('g:i A') ?>
                                        </div>
                                    </div>
                                    <div class="content_box">
                                        <?php the_content('Читать всё'); ?>
                                    </div>

                                    <div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></div>

                                    <div class="comments"><?php comments_popup_link('0 комментарии', 'комментарии', '% комментарии '); ?></div>
                                    <div class="link-edit"><?php edit_post_link('Edit', ''); ?></div>
                                </div>
                            </div></div></div>
                </div>
            <?php endwhile;}
开发者ID:xronn01,项目名称:www.prosvitcenter.org,代码行数:29,代码来源:myfunk.php


示例12: load_5speed_archive

function load_5speed_archive()
{
    echo "<h3 class=\"list-title\">My list of reasons why I drive a manual transmission car:</h3>";
    echo "<div class=\"5speed\">";
    while (have_posts()) {
        the_post();
        ?>
        <li>
            <h3 style="margin-bottom:0px;"># <a href="<?php 
        the_permalink();
        ?>
" rel="bookmark" title="Reason <?php 
        the_title_attribute();
        ?>
"><?php 
        the_title();
        ?>
</a></h3>
            <?php 
        the_content();
        ?>
        </li>
    <?php 
    }
    echo "</div>";
}
开发者ID:SloppierKitty7,项目名称:wp-theme-gus,代码行数:26,代码来源:postype-5speed.php


示例13: widget

    public function widget($args, $instance)
    {
        ?>
			<?php 
        echo $args['before_widget'];
        ?>
			<?php 
        echo $args['before_title'];
        echo $instance['title'];
        echo $args['after_title'];
        ?>
            <div class="list-group">
			<?php 
        $arg = array('posts_per_page' => 5, 'post_type' => 'post', 'orderby' => 'date', 'order' => 'DESC');
        $newposts = new WP_Query($arg);
        while ($newposts->have_posts()) {
            $newposts->the_post();
            ?>
			  <a class="list-group-item" href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a>
			<?php 
        }
        wp_reset_postdata();
        ?>
			</div>
            <?php 
        echo $args['after_widget'];
        ?>
        <?php 
    }
开发者ID:TailoredMarketing,项目名称:uPrint,代码行数:35,代码来源:widgets.php


示例14: woo_widget_tabs_latest

    function woo_widget_tabs_latest($posts = 5, $size = 45)
    {
        global $post;
        $latest = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'post_date', 'order' => 'desc', 'numberposts' => $posts));
        foreach ($latest as $post) {
            setup_postdata($post);
            ?>
			<li>
				<?php 
            if ($size != 0) {
                woo_image('height=' . $size . '&width=' . $size . '&class=thumbnail&single=true');
            }
            ?>
				<a title="<?php 
            the_title_attribute();
            ?>
" href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a>
				<span class="meta"><?php 
            the_time(get_option('date_format'));
            ?>
</span>
				<div class="fix"></div>
			</li>
		<?php 
        }
        wp_reset_postdata();
    }
开发者ID:shramee,项目名称:test-ppb,代码行数:33,代码来源:woo-tabs.php


示例15: grid_archive_theme

function grid_archive_theme($post)
{
    ?>
<div class="archive-listing classic-grid">
		<a href="<?php 
    the_permalink();
    ?>
">
		<div style="background-image:url('<?php 
    if (wp_get_attachment_url(get_post_thumbnail_id($post->ID))) {
        $url = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
    } else {
        $url = default_product_thumbnail_url();
    }
    echo $url;
    ?>
');" class="classic-grid-element"></div>
		<div class="product-name"><?php 
    the_title();
    ?>
</div>
		<?php 
    do_action('archive_price', $post);
    ?>
		</a>
</div>
<?php 
}
开发者ID:satokora,项目名称:IT354Project,代码行数:28,代码来源:classic-grid.php


示例16: widget

	/** @see WP_Widget::widget */
	function widget($args, $instance) {
		$cache = wp_cache_get('widget_recent_products', 'widget');

		if ( !is_array($cache) ) $cache = array();

		if ( isset($cache[$args['widget_id']]) ) {
			echo $cache[$args['widget_id']];
			return;
		}

		ob_start();
		extract($args);
		
		$title = apply_filters('widget_title', empty($instance['title']) ? __('New Products', 'jigoshop') : $instance['title'], $instance, $this->id_base);
		if ( !$number = (int) $instance['number'] )
			$number = 10;
		else if ( $number < 1 )
			$number = 1;
		else if ( $number > 15 )
			$number = 15;

    $show_variations = $instance['show_variations'] ? '1' : '0';

    $args = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'post_type' => 'product');

    if($show_variations=='0'){
      $args['meta_query'] = array(
			  array(
				  'key' => 'visibility',
				  'value' => array('catalog', 'visible'),
				  'compare' => 'IN'
			  )
		  );
		  $args['parent'] = '0';
    }

		$r = new WP_Query($args);
		
		if ($r->have_posts()) :
?>
		<?php echo $before_widget; ?>
		<?php if ( $title ) echo $before_title . $title . $after_title; ?>
		<ul class="product_list_widget">
		<?php  while ($r->have_posts()) : $r->the_post(); $_product = &new jigoshop_product(get_the_ID()); ?>
		<li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>">
			<?php if (has_post_thumbnail()) the_post_thumbnail('shop_tiny'); else echo '<img src="'.jigoshop::plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.jigoshop::get_var('shop_tiny_w').'px" height="'.jigoshop::get_var('shop_tiny_h').'px" />'; ?>
			<?php if ( get_the_title() ) the_title(); else the_ID(); ?>
		</a> <?php echo $_product->get_price_html(); ?></li>
		<?php endwhile; ?>
		</ul>
		<?php echo $after_widget; ?>
<?php
		// Reset the global $the_post as this query will have stomped on it
		//wp_reset_postdata();

		endif;

		if (isset($args['widget_id']) && isset($cache[$args['widget_id']])) $cache[$args['widget_id']] = ob_get_flush();
		wp_cache_set('widget_recent_products', $cache, 'widget');
	}
开发者ID:rszczypka,项目名称:jigoshop,代码行数:61,代码来源:recent_products.php


示例17: mdwpbp_related_posts

function mdwpbp_related_posts()
{
    global $post;
    $tags = wp_get_post_tags($post->ID);
    if ($tags) {
        foreach ($tags as $tag) {
            $tag_arr = $tag->slug . ',';
        }
        $args = array('tag' => $tag_arr, 'numberposts' => 5, 'post__not_in' => array($post->ID));
        $related_posts = get_posts($args);
        if ($related_posts) {
            echo '<p class="related-posts-header">Related Posts</p><ul id="mdwpbp-related-posts">';
            foreach ($related_posts as $post) {
                setup_postdata($post);
                echo '<li class="related-post"><a href="';
                the_permalink();
                echo '">';
                the_title();
                echo '</a></li>';
            }
            echo '</ul>';
        }
    }
    // if ($tags)
    wp_reset_postdata();
}
开发者ID:jonathanbell,项目名称:my-damn-wordpress-boilerplate,代码行数:26,代码来源:functions.php


示例18: stars_teams

function stars_teams($gender, $season)
{
    $args = array('season' => $season, 'gender' => $gender, 'post_type' => 'team', 'posts_per_page' => -1);
    $teams = new WP_Query($args);
    ?>
        <h3><?php 
    echo ucfirst($gender) . ' ' . $season;
    ?>
 Teams</h3>
        <?php 
    if ($teams->have_posts()) {
        while ($teams->have_posts()) {
            $teams->the_post();
            ?>
            <p class="team-list-item"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></p>
        <?php 
        }
    }
    ?>
    <?php 
}
开发者ID:sniezekjp,项目名称:prod-fs,代码行数:27,代码来源:template-functions.php


示例19: post_excerpts_here

function post_excerpts_here()
{
    //posts with date, author, time, content excerpts, and title..
    if (have_posts()) {
        while (have_posts()) {
            echo '<div class="excerpt-div">';
            the_post();
            echo '<h2 class="post-title"><a href="';
            the_permalink();
            echo '" title="';
            the_title();
            echo '">';
            the_title();
            echo '</a></h2>';
            echo '<h4 class="post-info">';
            echo 'Created on ';
            the_date();
            echo ' at ';
            the_time();
            echo ' by ';
            the_author_meta(first_name);
            echo '.</h4>';
            echo '<p class="post-excerpt">';
            the_excerpt();
            echo '</p>';
            echo '</div>';
        }
        // end while
    }
    // end if
}
开发者ID:jbrown25,项目名称:Apicat-WP-theme,代码行数:31,代码来源:functions.php


示例20: tpp_posts_widget

function tpp_posts_widget()
{
    ?>
	<h3>Posts on this page:</h3>
	<?php 
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            ?>
	<div>
	<a href="<?php 
            echo the_permalink();
            ?>
"
		title="<?php 
            echo the_title();
            ?>
"><?php 
            echo the_title();
            ?>
</a>
		(<?php 
            echo comments_number();
            ?>
)
	</div>
	<?php 
        }
    }
    ?>
	<?php 
}
开发者ID:kirandash,项目名称:bijiplugindfly,代码行数:32,代码来源:top_posts_endStep2.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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