Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress not retrieving a certain category
    primarykey
    data
    text
    <p>I have the following code in an Wordpress template file (Goodwork theme) which outputs a list of posts.</p> <pre><code>$args = array( 'posts_per_page' =&gt; $v_filter == 'true' ? -1 : 12, 'offset'=&gt; 0, 'paged' =&gt; $paged, 'portfolio_category' =&gt; $custom_cat, 'post_type' =&gt; 'portfolio'); $all_posts = new WP_Query($args); </code></pre> <p>The bit I'm having trouble with is <code>$custom_cat</code> which is set further above in the template like so:</p> <pre><code>$v_cats = get_post_meta($post-&gt;ID, 'rb_meta_box_portfolio_set', true); $all_cats = !empty($v_cats) ? implode($v_cats, ', ') : -1; $custom_cat = isset($_GET['f']) ? $_GET['f'] : $all_cats; </code></pre> <p>The problem is that it's ignoring posts from a certain category.</p> <p>If I change the code to <code>$custom_cat = 'promotions'</code> which is the name of the category not showing, then it outputs posts from that category, but not when pulling all categories.</p> <p>Anyone have an idea why that might be?</p> <p>In answer to BIOSTALL's question, the only other place that <code>rb_meta_box_portfolio_set</code> is referenced is in metaboxes.php where it's setting the Portfolio Post Type:</p> <pre><code>$rb_meta_box_portfolio = array( 'id' =&gt; 'rb_meta_box_portfolio', 'title' =&gt; 'Portfolio Options', 'desc' =&gt; '', 'pages' =&gt; array( 'page' ), 'context' =&gt; 'normal', 'priority' =&gt; 'high', 'fields' =&gt; array( array( 'id' =&gt; 'rb_meta_box_portfolio_set', 'label' =&gt; 'Choose categories', 'desc' =&gt; 'Select the categories which will appear in this portfolio.', 'std' =&gt; 'portfolio', 'type' =&gt; 'checkbox', 'class' =&gt; '', 'choices' =&gt; $portfolios_array ), </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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