本文整理汇总了PHP中the_permalink函数的典型用法代码示例。如果您正苦于以下问题:PHP the_permalink函数的具体用法?PHP the_permalink怎么用?PHP the_permalink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_permalink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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
}
}
}
示例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
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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"></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;
}
示例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;}
示例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>";
}
示例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
}
示例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();
}
示例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
}