Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You use the_permalink function to call the comments box, but your related post query affected it, so you need to use <code>wp_reset_query()</code>. I've also add <code>&lt;li&gt;</code> in the list and remove the php shortcode <code>&lt;?</code> instead <code>&lt;?php</code> (For many servers, this not working).</p> <p>You should try this :</p> <pre><code>&lt;?php $categories = get_the_category($post-&gt;ID); if ($categories) { $category_ids = array(); foreach($categories as $individual_category) $category_ids[] = $individual_category-&gt;term_id; $args=array( 'category__in' =&gt; $category_ids, 'post__not_in' =&gt; $showed_posts, 'showposts'=&gt;3, // Number of related posts that will be shown. 'caller_get_posts' =&gt; 1, 'exclude' =&gt; '$postID', 'orderby' =&gt; 'rand' ); $my_query = new wp_query($args); if( $my_query-&gt;have_posts() ) { echo '&lt;ul&gt;'; while ($my_query-&gt;have_posts()) { $my_query-&gt;the_post(); ?&gt; &lt;li&gt; &lt;div class="relatedpost"&gt; &lt;a rel="external" href="&lt;?php the_permalink()?&gt;"&gt;&lt;?php the_post_thumbnail(array(175,98)); ?&gt;&lt;/a&gt; &lt;br /&gt; &lt;a rel="external" href="&lt;?php the_permalink()?&gt;"&gt;&lt;center&gt;&lt;h6&gt;&lt;?php the_title(); ?&gt;&lt;/h6&gt;&lt;/center&gt;&lt;/a&gt; &lt;/div&gt; &lt;/li&gt; &lt;?php } echo '&lt;/ul&gt;'; } } ?&gt; &lt;?php wp_reset_query(); ?&gt; &lt;center&gt; &lt;div id="fb-root"&gt;&lt;/div&gt; &lt;script src="http://connect.facebook.net/en_US/all.js#xfbml=1"&gt;&lt;/script&gt; &lt;fb:comments href="&lt;?php the_permalink(); ?&gt;" width="640"&gt;&lt;/fb:comments&gt; &lt;/center&gt; </code></pre>
 

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