如何提高WP程序发布文章的质量
来源:互联网 发布:android程序员的简历 编辑:程序博客网 时间:2024/05/22 10:35
如何提高WP程序发布文章的质量
1. Add post formart support to your wordpress theme
// Hook into the 'after_setup_theme' action
add_action( 'after_setup_theme', 'coolwp_a' );
function coolwp_a() {
// Add theme support for Post Formats
$formats = array( 'status', 'quote', 'gallery', 'image', 'video', 'audio', 'link', 'aside', 'chat', );
add_theme_support( 'post-formats', $formats );
}
2. Terms of each post formart in wordpress
post-format-aside
post-format-audio
post-format-chat
post-format-gallery
post-format-image
post-format-link
post-format-status
post-format-quote
post-format-video
3.Query posts of someone post formart
Get a list of your post formart:
$my_formats = get_post_format_slugs();
foreach ( (array) $my_formats as $i => $format ) {
$my_formats[$i] = 'post-format-' . $format;
}
posts only in image formart:
$images = get_posts( array(
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-image' ),
'operator' => 'IN'
)
)
) );
posts not in image formart:
$no_images = get_posts( array(
'tax_query' => array(
array( 自吸磁力泵
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-image' ),
'operator' => 'NOT IN'
)
)
) );
Exclude posts in image and status:
$exclude_images_and_status = get_posts( array(
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-image', 'post-format-status' ),
'operator' => 'NOT IN',
)
)
) );
An example:http://www.hrbgaj.gov.cn/
$my_formats = get_post_format_slugs();
foreach ( (array) $my_formats as $i => $format ) {
$my_formats[$i] = 'post-format-' . $format;
}
$standard_posts = get_posts( array(
'tax_query' => array(
array( 自吸磁力泵
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => $my_formats,
'operator' => 'NOT IN'
)
)
) );
global $post;
foreach( (array) $standard_posts as $post ) {
setup_postdata( $post );
print '<div>';
the_title( '<h2>', '</h2>' );
the_content();
print '</div>';
}
wp_reset_postdata();
0 0
- 如何提高WP程序发布文章的质量
- 如何提高WP的图片清晰度应用技术
- 《高质量C++编程指南》如何提高程序的效率
- 如何提高代码的质量
- 如何提高软件的质量
- 如何提高函数的质量
- 谈如何提高搜索引擎收录的质量
- 如何提高IC测试代码的质量?
- 如何提高你的代码质量
- 如何快速提高App的质量?
- 如何提高睡眠质量
- 如何提高项目质量
- 如何提高睡眠质量
- 如何提高睡眠质量
- 如何提高代码质量?
- 如何提高睡眠质量?
- 如何提高代码质量
- 如何提高代码质量
- 模拟二叉树 — 纪念植树节……
- Android Matrix类实现J2ME的drawRegion的镜像方法
- Cookie详解
- Erlang安装时加载openssl的libcrypto.a失败,执行crypto:start()报错的解决方案
- VC6.0 显示代码行号
- 如何提高WP程序发布文章的质量
- Linux下,创建和删除软、硬链接
- 升级到XCode5.1报错的解决办法
- java concurrent 探秘
- 线性表求与运算
- uva 10239 - The Book-shelver's Problem(记忆化搜索)
- 动态规划-排列组合
- 黑马程序员---交通灯
- mysql主从单向和双向备份配置