Javascript 如何在php代码中显示这样的样式
我有这样一个完美的代码:Javascript 如何在php代码中显示这样的样式,javascript,php,jquery,css,Javascript,Php,Jquery,Css,我有这样一个完美的代码: <h2 class="index-single">Tech Categories</h2><?php $args2 = array( 'cat' => 11 , 'posts_per_page' => 9 , 'paged' => $paged ); $the_query2 = new WP_Query( $args2 ); // The Loop if ( $the_query2->have_posts() )
<h2 class="index-single">Tech Categories</h2><?php
$args2 = array( 'cat' => 11 , 'posts_per_page' => 9 , 'paged' => $paged );
$the_query2 = new WP_Query( $args2 );
// The Loop
if ( $the_query2->have_posts() ) {
echo '<ul>';
while ( $the_query2->have_posts() ) {
$the_query2->the_post();
echo '<li>' . get_template_part( 'thumb' ) . '</li>';
}
echo '</ul>';
/* Restore original Post Data */
wp_reset_postdata();
} else {
// no posts found
} ?>
技术类别
但是我不想使用类(ul和li),但是
我想使用代码(行和boxer2
我想稍后显示tumbnail parallel
我已尝试替换代码ul行,以及liboxer2。
但结果并不令人满意
希望有一个解决方案。正如评论中指出的,只需在
ul
和li
元素中添加所需的类:
if ( $the_query2->have_posts() ) {
echo '<ul class="row">';
while ( $the_query2->have_posts() ) {
$the_query2->the_post();
echo '<li class="boxer2">' . get_template_part( 'thumb' ) . '</li>';
}
echo '</ul>';
/* Restore original Post Data */
wp_reset_postdata();
} else {
// no posts found
}
if($the_query2->have_posts()){
echo';
而($the_query2->have_posts()){
$the_query2->the_post();
回显“- ”。获取模板零件('thumb')。
;
}
回声“
”;
/*恢复原始Post数据*/
wp_reset_postdata();
}否则{
//没有找到帖子
}
你的意思是echo'
?除了h2
元素上的类之外,你目前没有使用任何其他类。你使用的是一个html无序列表ul
,带有嵌套列表项li
。你能共享更多的代码吗?你的css在哪里“但结果不令人满意”然后给我们一个期望结果的例子。没有ul和li,我想使用