wordpress调用相同文章形式的内容列表
大挖的wordpress导航主题,集成了两种文章形式,默认形式即导航形式,还有一个日志形式,就是我们传统说的资讯形式,在使用相关文章和资讯列表调用时,大挖使用的相关的wordpress文章形式调用,这样可以避免出样在不同的列表里出来导航列表内容又出现资讯文章内容。
现在把代码分享给大家,需要提示给大家的是此段代码里的post-format-image是主要的核心要素,格式是这样的post-format-{name},name是指文章形式的名称,可以用的有:aside、image、video、quote、link、gallery、status、audio、chat等wordpress默认的文章形式。
12345678910111213141516171819202122<?php $posts = get_posts(array('numberposts' => '10','post_type' => 'post','tax_query'=>array(array('taxonomy'=>'post_format','field' => 'slug','terms' => array('post-format-image'))),));if($posts):foreach($posts as $post):?><li><a href="<?php%20the_permalink();%20?>" target="_blank" title="<?php the_title();?>"><?php the_title();?></a></li><?php wp_reset_postdata(); endforeach; endif; ?>内容页面调用相同文章形式的文章列表
1234567891011121314151617181920212223<?php $posts = get_posts(array('numberposts' => '10','post_type' => 'post','exclude'=>get_the_ID(),'tax_query'=>array(array('taxonomy'=>'post_format','field' => 'slug','terms' => array('post-format-image'.get_post_format()))),));if($posts):foreach($posts as $post):?><li><a href="<?php%20the_permalink();%20?>" target="_blank" title="<?php the_title();?>"><?php the_title();?></a></li><?php wp_reset_postdata(); endforeach; endif; ?>上一篇:解决阿里云盾控制台wordpress IP验证不当漏洞提示的方法
下一篇:常用的360搜索好搜代码/百度搜索代码/淘宝搜索代码/
admlib32.exe是什么文件?admlib32.exe是不是病毒
Windows XP是什么文件?Windows XP是不是病毒
Theworld.exe是什么文件?Theworld.exe是不是病毒
adss.exe是什么文件?adss.exe是不是病毒
adp.exe是什么文件?adp.exe是不是病毒
AdManCtl.exe是什么文件?AdManCtl.exe是不是病毒
adobes.exe是什么文件?adobes.exe是不是病毒
ewidoctrl.exe是什么文件?ewidoctrl.exe是不是病毒
fastait.exe是什么文件?fastait.exe是不是病毒
adsub.exe是什么文件?adsub.exe是不是病毒