将内容放入Post循环中

时间:2016-10-12 作者:Brian

是否有人有幸操纵Post循环在Post数据之间插入内容?我希望在我的帖子之间发布内容,因为它们显示在存档和主页模板上。

if ( !empty($theme_option[\'archive-num-excerpt\']) ) {
briad_set_gb_variable(\'briad_excerpt_length\', 55);
add_filter(\'excerpt_length\', \'briad_set_excerpt_length\');
}
global $wp_query;
$briad_post_settings = briad_get_gb_variable(\'briad_post_settings\');
$briad_post_settings[\'excerpt\'] = 55;
$briad_post_settings[\'thumbnail-size\'] = \'full\';            
$briad_post_settings[\'blog-style\'] = \'blog-full\';                           
echo \'<div class="blog-item-holder">\';
if ($briad_post_settings[\'blog-style\'] == \'blog-full\') {
$briad_post_settings[\'blog-info\'] = array(\'author\', \'date\', \'category\', \'comment\');
briad_set_gb_variable(\'briad_post_settings\', $briad_post_settings);
echo briad_get_blog_full($wp_query);
} else {
$briad_post_settings[\'blog-info\'] = array(\'date\', \'comment\');
$briad_post_settings[\'blog-info-widget\'] = true;
briad_set_gb_variable(\'briad_post_settings\', $briad_post_settings);
$blog_size = str_replace(\'blog-1-\', \'\', $theme_option[\'archive-blog-style\']);
echo briad_get_blog_grid($wp_query, $blog_size, $theme_option[\'archive-thumbnail-size\'], \'fitRows\');
}
echo \'<div class="clear"></div></div>\';
remove_filter(\'excerpt_length\', \'briad_set_excerpt_length\');
$paged = (get_query_var(\'paged\'))? get_query_var(\'paged\') : 1;
echo briad_get_pagination($wp_query->max_num_pages, $paged);

1 个回复
SO网友:Andy Macaulay-Brook

就像循环开始动作一样loop_start 火灾。在循环迭代时设置每个帖子之后,the_post 火灾。循环完成后,loop_end 火灾。

如果需要检查上下文,这些操作中的每一个都会收到对查询对象的引用。

如果您可以控制主题代码,那么在那里插入内部post代码当然也很容易。