所以我想在我的主页上创建两个循环。一个可以显示页面自身内容的页面,然后在其正下方有一个网格循环,用于从“新闻”类别中获取两篇最新帖子。我真的找不到一种方法来做这件事,所以我四处黑客攻击,直到我让它工作起来,但我不确定这是正确的做法,有人能告诉我我可以/应该对这段代码做些什么改进吗?
以下是我的截图:http://s18.postimg.org/knrq6sert/2013_11_13_22_55_58.png
主题:MetroTemplate:主页。php
//* Add support for Genesis Grid Loop
//remove_action( \'genesis_loop\', \'genesis_do_loop\' );
add_action( \'genesis_loop\', \'child_grid_loop_helper\' );
function child_grid_loop_helper() {
if ( function_exists( \'genesis_grid_loop\' ) ) {
global $post;
// arguments, adjust as needed
$args = array(
\'post_type\' => \'post\',
\'posts_per_page\' => 2,
\'post_status\' => \'publish\',
\'paged\' => get_query_var( \'paged\' )
);
/*
Overwrite $wp_query with our new query.
The only reason we\'re doing this is so the pagination functions work,
since they use $wp_query. If pagination wasn\'t an issue,
use: https://gist.github.com/3218106
*/
global $wp_query;
$wp_query = new WP_Query( $args );
genesis_grid_loop( array(
\'features\' => 0,
\'feature_image_size\' => 0,
\'feature_image_class\' => \'alignleft post-image\',
\'feature_content_limit\' => 0,
\'grid_image_size\' => 0,
\'grid_image_class\' => \'alignleft post-image\',
\'grid_content_limit\' => 100,
\'more\' => __( \'[Continue reading...]\', \'genesis\' ),
) );
}
}
//* Remove the post meta function for front page only
remove_action( \'genesis_after_post_content\', \'genesis_post_meta\' );
genesis();`
有两件事我还没有弄明白。
如何更改网格循环的标题<h2>
到<h3>
. 我必须设计<h2>
在该屏幕截图上,因此它们将是1.5 rem,而不是默认的3 rem。但理想情况下,它们将是<h3>
.
如何从网格循环中的这两篇文章中删除文章作者。
感谢您的帮助。