{"id":3008212,"date":"2012-08-31T04:06:55","date_gmt":"2012-08-31T04:06:55","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/categories-and-sub-categories-6\/"},"modified":"2016-08-20T15:19:46","modified_gmt":"2016-08-20T15:19:46","slug":"categories-and-sub-categories-6","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/categories-and-sub-categories-6\/","title":{"rendered":"categories and sub categories"},"content":{"rendered":"<p><em>[ Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still &#8211; use the <a href=\"http:\/\/wordpress.pastebin.com\/\">pastebin.com<\/a>. As it is, the forum parser may have messed up your posted code. ]<\/em><\/p>\n<pre><code>&lt;?php get_header(); ?&gt;\n\n&lt;!-- #primary --&gt;\n&lt;div id=&quot;primary&quot; class=&quot;container clearfix&quot;&gt;\n\n&lt;!-- #content --&gt;\n  &lt;section id=&quot;content&quot; role=&quot;main&quot;&gt;\n\n  &lt;div id=&quot;page-header&quot;&gt;\n  &lt;h2&gt;&lt;?php __(&#039;Article Categories&#039;,&#039;framework&#039;) ?&gt;&lt;\/h2&gt;\n  &lt;\/div&gt;\n\n&lt;div id=&quot;homepage-categories&quot; class=&quot;clearfix&quot;&gt;\n\n&lt;?php\n$cat_args = array(\n  &#039;orderby&#039; =&gt; &#039;name&#039;,\n  &#039;order&#039; =&gt; &#039;ASC&#039;,\n  &#039;child_of&#039; =&gt; 0\n);\n\n$categories =   get_categories($cat_args); \n\nforeach($categories as $category) {\n\t$catCounter++;\n\n\tif ((!is_int($catCounter \/ 2)) &amp;&amp; $catCounter != 1) {\necho &#039;&lt;\/div&gt;&lt;div class=&quot;row&quot;&gt;&#039;;} elseif ($catCounter == 1)\n{ echo &#039;&lt;div class=&quot;row half-gutter&quot;&gt;&#039;;}\n\n    echo &#039;&lt;div class=&quot;column col-half &#039;. $catCounter.&#039;&quot;&gt;&#039;;\n    echo &#039;&lt;h3&gt; &lt;a&gt;term_id ) . &#039;&quot; title=&quot;&#039; . sprintf( __( &quot;View all posts in %s&quot; ), $category-&gt;name ) . &#039;&quot; &#039; . &#039;&gt;&#039; . $category-&gt;name.&#039;&lt;\/a&gt;&lt;span class=&quot;cat-count&quot;&gt;(&#039; . $category-&gt;count.&#039;)&lt;\/span&gt;&lt;\/h3&gt;&#039;;\n\n     $post_args = array(\n      &#039;numberposts&#039; =&gt; 5,\n      &#039;category&#039; =&gt; $category-&gt;term_id\n    );\n\n    $posts = get_posts($post_args);\n\techo &#039;&lt;ul class=&quot;category-posts&quot;&gt;&#039;;\n\tforeach($posts as $post) {\n\t?&gt;\n\n&lt;li&gt;&lt;a&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;\/a&gt;&lt;\/li&gt;\n\t&lt;?php\n\t}\n\techo &#039;&#039;;\n\techo &#039;&lt;\/div&gt;&#039;;\n}\n?&gt;\n&lt;\/div&gt;\n&lt;\/div&gt;\n\n&lt;\/section&gt;\n&lt;!-- #content --&gt;\n\n&lt;?php get_sidebar(); ?&gt;\n&lt;!-- #sidebar --&gt;\n&lt;\/aside&gt;\n\n&lt;\/div&gt;\n&lt;!-- #primary --&gt;\n&lt;?php get_footer(); ?&gt;<\/code><\/pre>\n<p>so basically it displays each category and sub category and post within it each with its own symbol. i want the top level category to show, and then after the jump, the second lvl, and then after that jump the final lvl&#8230;. basically i need to do, Los Angeles as parent&#8230; then the cities within los angeles Venice, Santa monica, etc&#8230; then within that, Sunday-Saturday&#8230;<\/p>\n","protected":false},"template":"","class_list":["post-3008212","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3008212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3008212\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=3008212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}