Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You may try this</p> <pre><code>&lt;?php // get all the categories $cats = get_categories(); // loop through the categries foreach ($cats as $cat) { // Get the cateogory ID $cat_id= $cat-&gt;term_id; //Header for the cateogry echo "&lt;h2&gt;".$cat-&gt;name."&lt;/h2&gt;"; // Make a custom wordpress query query_posts("cat=$cat_id&amp;post_per_page=12"); // start wordpress loop if (have_posts()) : while (have_posts()) : the_post(); ?&gt; &lt;a href="&lt;?php the_permalink();?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt; &lt;?php echo '&lt;hr/&gt;'; endwhile; endif; // End of WordPress loop } // End of foreach loop through category ?&gt; </code></pre> <p>If you want to get only one category (drivers) then</p> <pre><code>&lt;?php $cat_name = 'drivers'; $term = get_term_by('name', $cat_name, 'category'); $cat_id=$term-&gt;term_id; query_posts("cat=$cat_id&amp;post_per_page=12"); // start wordpress loop if (have_posts()) : while (have_posts()) : the_post(); ?&gt; &lt;a href="&lt;?php the_permalink();?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt; &lt;?php echo '&lt;hr/&gt;'; endwhile; endif; ?&gt; </code></pre> <p>May be this one can help you</p> <pre><code>&lt;?php $cat_names = array('team1', 'team2', 'team3'); foreach($cat_names as $cat) { $term = get_term_by('name', $cat, 'category'); $cat_id=$term-&gt;term_id; query_posts("cat=$cat_id&amp;post_per_page=12"); // start wordpress loop if (have_posts()) : while (have_posts()) : the_post(); ?&gt; &lt;a href="&lt;?php the_permalink();?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt; &lt;?php echo '&lt;hr/&gt;'; endwhile; endif; } ?&gt; </code></pre>
    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.
 

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