Note that there are some explanatory texts on larger screens.

plurals
  1. POWordPress: Using custom field to define posts to display in loop
    primarykey
    data
    text
    <p>I'm trying to use a custom field in which I input the post ID numbers of the posts I want to show, seperated by commas. For some reason though, only the first post of the series of the post IDs are displaying. Can someone help? The value of $nlPostIds is (minus the quotes): "1542,1534,1546". Here's the code... the most important part is the 4th line <code>'post__in' =&gt; array($nlPostIds)</code></p> <pre><code>&lt;?php $nlPostIds = get_post_meta($post-&gt;ID, 'nlPostIds', true); $args=array( 'post__in' =&gt; array($nlPostIds) ); query_posts($args); if ( $wp_query-&gt;have_posts() ) : while ( $wp_query-&gt;have_posts() ) : $wp_query-&gt;the_post(); ?&gt; &lt;div class="entry"&gt; &lt;div class="post" id="post-&lt;?php the_ID(); ?&gt;"&gt; &lt;h2&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link to &lt;?php the_title_attribute(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt; &lt;div class="allinfos"&gt;&lt;span class="date"&gt;&lt;?php the_time('F jS, Y') ?&gt;&lt;/span&gt; | &lt;span class="comments"&gt;&lt;?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?&gt; &lt;/span&gt; | &lt;span class="category"&gt;Posted in &lt;?php the_category(', ') ?&gt;&lt;/span&gt; &lt;!-- by &lt;?php the_author() ?&gt; --&gt;&lt;/div&gt; &lt;?php the_content('More &amp;raquo;'); ?&gt; &lt;?php the_tags('Tags: ', ', ', ' '); ?&gt; &lt;?php edit_post_link('Edit', '[ ', ' ]'); ?&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt; &lt;?php endwhile; endif; ?&gt; </code></pre> <p>Thanks!</p>
    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.
    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