Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/431.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在php代码中显示这样的样式_Javascript_Php_Jquery_Css - Fatal编程技术网

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
} ?>
技术类别
但是我不想使用类(ulli),但是 我想使用代码(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,我想使用