wp_editor( '', comment, $settings = array(
'quicktags'=> 1,
//WP默认按钮有strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close 请自行选择
'quicktags'=> array('buttons' => 'strong,em,link,del,img,ul,ol,li,code,spell,close',),
'tinymce'=>0,
'media_buttons'=>0,
'textarea_rows'=>4,
'editor_class'=>"textareastyle"
) );
has_shortcode( $post->post_content, 'gallery' );
echo wp_logout_url( home_url() );
function show_gallery_image_urls( $content ) {
global $post;
// 只在单页面执行此函数
if( ! is_singular() )
return $content;
// 确保文章中有相册简码
if( ! has_shortcode( $post->post_content, 'gallery' ) )
return $content;
//返回的是图片对象
$galleries = get_post_galleries( $post, false );
$idsStr = wp_list_pluck( $galleries, 'ids' );
$ids = explode(',', $idsStr[0] );
$image_list = '';
foreach ($ids as $k => $v) {
$image_list .= '' . wp_get_attachment_image($v) . '';
}
/*// 获取所有相册的图片 返回的是src
$galleries = get_post_galleries_images( $post );
// 遍历所有相册
foreach( $ids as $gallery ) {
// 遍历所有相册中的图片
foreach( $gallery as $image ) {
$image_list .= '' . $image . '';
}
}*/
$image_list .= '';
// 附加图片列表到文章中
$content .= $image_list;
return $content;
}
add_filter( 'the_content', 'show_gallery_image_urls' );
wp_get_attachment_image_src($id)
截取字符串
cut_str();
wp_query
https://www.wpzhiku.com/all-wp_query-arguments-comments/
$args = array(
'meta_key' => 'reviewed', //wp-usermeta 表中的字段名,元素关键词
'meta_value' => 1, //wp-usermeta 表中的字段名,meta_key的值
'orderby' => 'registered', //排序方式,nicename', 'email', 'url', 'registered', 'display_name', or 'post_count'
'order' => 'DESC', // 升序或者降序DESC
'offset' => $offset, //偏移量
//'search' => , //匹配搜索词
'number' => $rows, //显示用户数量
'count_total' => true, //总数统计
);
$result = get_users($args);