Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's not necessary to transform the object to an array, you can perfectly work with the object without too much hassle. What is curious (at least for me), is that you get something like this:</p> <pre><code> Array ( [0] =&gt; stdClass Object ( [term_id] =&gt; 7 [name] =&gt; Magister comunicaciones aplicadas [slug] =&gt; magister-comunicaciones-aplicadas [term_group] =&gt; 0 [term_taxonomy_id] =&gt; 7 [taxonomy] =&gt; linea-de-estudio [description] =&gt; [parent] =&gt; 0 [count] =&gt; 4 ) [1] =&gt; stdClass Object ( [term_id] =&gt; 8 [name] =&gt; Engagement marketing [slug] =&gt; engagement-marketing [term_group] =&gt; 0 [term_taxonomy_id] =&gt; 8 [taxonomy] =&gt; linea-de-estudio [description] =&gt; [parent] =&gt; 0 [count] =&gt; 5 ) ) </code></pre> <p>It's basically, an array of objects, so you've to treat them that way. For example if I want the name of the the first one:</p> <pre><code>$myterms = get_terms('taxonomy-name', 'orderby=none&amp;hide_empty'); echo $myterms[0]-&gt;name; </code></pre> <p>If you need to iterate through the elements, you still can use <code>foreach();</code>.</p> <pre><code>foreach ($myterms as $term) { ?&gt; &lt;li&gt;&lt;a href="&lt;?php echo $term-&gt;slug; ?&gt;"&gt;&lt;?php echo $term-&gt;name; ?&gt;&lt;/a&gt;&lt;/li&gt; &lt;?php } ?&gt; </code></pre> <p>That way you can post the articles from your taxonomy.</p> <p>For the custom post types, you'll have to create a loop like this:</p> <pre><code>$args = array( 'post_type' =&gt; 'post-type-name', 'taxonomy' =&gt; 'term' //for example //'resources' =&gt; 'videos' ); // assigning variables to the loop global $wp_query; $wp_query = new WP_Query($args); // starting loop while ($wp_query-&gt;have_posts()) : $wp_query-&gt;the_post(); the_title(); blabla.... endwhile; </code></pre> <p>Then you can create multiple loops each of one for each taxonomy/term :).</p> <p>If you want to get even more fancy (don't want to repeat yourself a hundred times) you can include the second loop inside the first one and assign variables to the taxonomy (resources ie) and the terms it has (videos) (from your example only the last one). The idea is that you would have a normal (typical) wordpress loop restricted to the custom post-type <strong>and</strong> each one of the terms.</p> <pre><code>foreach ($myterms as $term) : ?&gt; &lt;li&gt;&lt;a href="&lt;?php echo $term-&gt;slug; ?&gt;"&gt;&lt;?php echo $term-&gt;name; ?&gt;&lt;/a&gt;&lt;/li&gt; &lt;?php $term_name = $term-&gt;slug; $args = array( 'post_type' =&gt; 'post-type-name', 'taxonomy' =&gt; "$term_name" ); // assigning variables to the loop global $wp_query; $wp_query = new WP_Query($args); // starting loop posting only while ($wp_query-&gt;have_posts()) : $wp_query-&gt;the_post(); the_title(); blabla.... endwhile; endforeach; ?&gt; </code></pre> <p>Obviously you can do the inverse thing too, create the normal loop for a single-template custom type (it's looks like you have only one), and inside includes all the custom terms.</p> <p>Not very elegant, but that's the best way I can came up with it :P. Hope that someone can understand this, sounds confusing. </p> <p>Maybe could it be possible with some callback function?.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload