我需要从WP-Bootstrap Wordpress文件中更改一些代码。
在他们的代码中,他们删除了标准的图库代码,并将其替换为自己的代码,并且接受它没有正确考虑行。
function gallery_shortcode_tbs($attr) {
global $post, $wp_locale;
$output = "";
$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID );
$attachments = get_posts($args);
if ($attachments) {
$output = '<div class="row-fluid"><ul class="thumbnails">';
foreach ( $attachments as $attachment ) {
$output .= '<li class="span3">';
$att_title = apply_filters( 'the_title' , $attachment->post_title );
$output .= wp_get_attachment_link( $attachment->ID , 'thumbnail', true );
$output .= '</li>';
}
$output .= '</ul></div>';
}
return $output;
}
有没有人可以建议如何编辑上面的代码来插入html代码来关闭行并在第3项之后开始另一个..或者我选择的任何数字?
提前谢谢。
[R
答案 0 :(得分:0)
查看默认的WP库短代码源,其中在指定的列数之后插入符号,在837-838行:
if ( $columns > 0 && ++$i % $columns == 0 )
$output .= '<br style="clear: both" />';