成都网站建设设计

将想法与焦点和您一起共享

wordpress推荐文章 wordpress site

WordPress集成底部滚动推荐条,让好文章不再被埋没

先判断下是否登录,然后获取当前用户对象,然后获取当前用户对象的信息,需要哪些用哪些:

网站建设哪家好,找创新互联建站!专注于网页设计、网站建设、微信开发、成都微信小程序、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了东宝免费建站欢迎大家使用!

1

2

3

4

5

6

7

8

9

10

11

12

13

14

if(is_user_logged_in()){

$current_user = wp_get_current_user();

/**

* @example Safe usage: $current_user = wp_get_current_user();

* if ( !($current_user instanceof WP_User) )

* return;

*/

echo 'Username: ' . $current_user-user_login . 'br /';

echo 'User email: ' . $current_user-user_email . 'br /';

echo 'User first name: ' . $current_user-user_firstname . 'br /';

echo 'User last name: ' . $current_user-user_lastname . 'br /';

echo 'User display name: ' . $current_user-display_name . 'br /';

echo 'User ID: ' . $current_user-ID . 'br /';

}

wordpress 如何设置和调用热点文章 推荐文章 头条文章

调用最新文章:

?php query_posts(‘showposts=14′); ?

ul

?php while (have_posts()) : the_post(); ?

lia title=”?php the_title(); ?” href=”?php the_permalink() ?”?php the_title(); ?/a/li

?php endwhile; ?

/ul

调用热门文章:

ul

?php

$post_num = 14; // 设置调用条数

$args = array(

‘post_password’ = ”,

‘post_status’ = ‘publish’, // 只选公开的文章.

‘post__not_in’ = array($post-ID),//排除当前文章

‘caller_get_posts’ = 1, // 排除置顶文章.

‘orderby’ = ‘comment_count’, // 依评论数排序.

‘posts_per_page’ = $post_num

);

$query_posts = new WP_Query();

$query_posts-query($args);

while( $query_posts-have_posts() ) { $query_posts-the_post(); ?

lia href=”?php the_permalink(); ?” title=”?php the_title(); ?”?php the_title(); ?/a/li

?php } wp_reset_query();?

/ul

调用随机文章:

ul

?php

global $post;

$postid = $post-ID;

$args = array( ‘orderby’ = ‘rand’, ‘post__not_in’ = array($post-ID), ‘showposts’ = 14);

$query_posts = new WP_Query();

$query_posts-query($args);

?

?php while ($query_posts-have_posts()) : $query_posts-the_post(); ?

lia href=”?php the_permalink(); ?” title=”?php the_title_attribute(); ?”?php the_title(); ?/a/li

?php endwhile; ?

/ul

wordpress博客文章下面怎样推荐文章

WordPress Related Posts(基础功能兼SEO类)

相关日志插件。WordPress Related Posts Plugin 最基本的功能就是根据日志的 tag(文章标签) 的相关性产生一个相关日志列表,并且可以把相关日志列表添加到 Feed 或日志中。最直接的应用就是可以设置一篇文章下方显示与此文章有相同文件标签的文章(也就是显示同一类文章)。这个插件不仅可以给浏览者一个“引路”的作用,同时对SEO有此不同忽视的作用。

好的话麻烦采纳

如何在WordPress中给推荐文章添加缩略图

这个主题我没有用过,但是听你说 thunbnail 我就想起我以前用过的知更鸟主题 编辑文章,Custom Fields里,左边写thumbnail,右边写图片地址


当前标题:wordpress推荐文章 wordpress site
文章路径:http://chengdu.cdxwcx.cn/article/dopohos.html