Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.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
动态数字PHP递增div id_Php_Jquery_Wordpress_Jquery Ui - Fatal编程技术网

动态数字PHP递增div id

动态数字PHP递增div id,php,jquery,wordpress,jquery-ui,Php,Jquery,Wordpress,Jquery Ui,我正在使用以下脚本: http://jqueryui.com/tabs/ 我用它来创建一个动态WordPress服装帖子类型分类显示。我设法动态地呈现了类别,但我需要为每个EDD类别创建某种动态数字id。 另外,我需要动态创建包含categody内容的DIV(我将在那里添加一个帖子列表) 以下是一些代码: <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.

我正在使用以下脚本:

http://jqueryui.com/tabs/
我用它来创建一个动态WordPress服装帖子类型分类显示。我设法动态地呈现了类别,但我需要为每个EDD类别创建某种动态数字id。
另外,我需要动态创建包含categody内容的DIV(我将在那里添加一个帖子列表)

以下是一些代码:

  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
  $(function() {
    $( "#tabs" ).tabs();
  });
  </script>
<?php

$taxonomy = 'portfolio_categories';
$terms = get_terms($taxonomy); // Get all terms of a taxonomy

if ( $terms && !is_wp_error( $terms ) ) :
?>


<div id="tabs">
    <ul>
        <?php foreach ( $terms as $term ) { ?>
            <li><a href="#tabs-<?php here i need the dynamic numeric ID ?>"><?php echo $term->name; ?></a></li>
        <?php } ?>
    </ul>
<div id="tabs-1">
i need this to be created dynamicly like the foreach
  </div>
  <div id="tabs-2">
i need this to be created dynamicly like the foreach

  </div>
  <div id="tabs-3">
so on and so on..
  </div>
</div>

$(函数(){
$(“#制表符”).tabs();
});
我需要像foreach一样动态地创建它 我需要像foreach一样动态地创建它 诸如此类。。
只需在循环中添加递增计数器:

<div id="tabs">
    <ul>
        <?php $counter = 0; ?>
        <?php foreach ( $terms as $term ) { ?>
            <li><a href="#tabs-<?php echo $counter; ?>"><?php echo $term->name; ?></a></li>
            <?php $counter++; ?>
        <?php } ?>
    </ul>
    <?php $counter = 0; ?>
    <?php foreach ( $terms as $term ) { ?>
        <div id="tabs-<?php echo $counter; ?>">
            i need this to be created dynamicly like the foreach
        </div>
        <?php $counter++; ?>
    <?php } ?>
</div>


谢谢!我们已经走到一半了。如何显示特定“$term->name;”中的帖子列表?