<?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' | '; } ?> <?php bloginfo('name'); ?><?if (is_home()){ $description ="..."> <?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' | '; } ?> <?php bloginfo('name'); ?><?if (is_home()){ $description ="..." /> <?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' | '; } ?> <?php bloginfo('name'); ?><?if (is_home()){ $description ="..." />
用户登录
用户注册

分享至

wordpress文章怎么输出

  • 作者: 水妖怪儿
  • 来源: 51数据库
  • 2020-04-21

wordpress文章标题输出

试试这个<?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' | '; } ?> <?php bloginfo('name'); ?><?if (is_home()){ $description =""; $keywords =""; } elseif (is_single()){ if ($post->post_excerpt) { $description = $post->post_excerpt; } else { $description = substr(strip_tags($post->post_content),0,220); } $keywords = ""; $tags = wp_get_post_tags($post->ID); foreach ($tags as $tag ) { $keywords = $keywords . $tag->name . ", "; }}?> 。

wordpress 如何根据文章ID输出正确内容,有代码

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

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 . '

';

echo 'User email: ' . $current_user->user_email . '

';

echo 'User first name: ' . $current_user->user_firstname . '

';

echo 'User last name: ' . $current_user->user_lastname . '

';

echo 'User display name: ' . $current_user->display_name . '

';

echo 'User ID: ' . $current_user->ID . '

';

}

Wordpress怎么输出某一分类下的文章地址和文章里一张图片的地址-

文章链接就不说了把the_permalink(); 这个函数首先获取所有图片,希望输出几张自己控制function all_img ( $ soContent ) {$ soImages = '~]*\ />~' ;preg_match_all ( $ soImages , $ soContent , $ thePics ) ;$ allPics = count ( $ thePics ) ;if ( $ allPics > 0 ) {$ count = 1 ; //赋予1的值foreach ( $ thePics [ 0 ] as $ v ) {if ( $ count == 4 ) { break ; } //当count等于4的时候跳出循环else { echo $ v ; }$ count ++ ; //循环+1}}else {echo "" ;}}//$conut自己控制要调用一张或者几张。

转载请注明出处51数据库 » wordpress文章怎么输出

软件
前端设计
程序设计
Java相关