Title: dunc's Replies | WordPress.org

---

# dunc

  [  ](https://wordpress.org/support/users/dunc/)

 *   [Profile](https://wordpress.org/support/users/dunc/)
 *   [Topics Started](https://wordpress.org/support/users/dunc/topics/)
 *   [Replies Created](https://wordpress.org/support/users/dunc/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/dunc/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/dunc/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/dunc/engagements/)
 *   [Favorites](https://wordpress.org/support/users/dunc/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/users/dunc/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/dunc/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Yoast Duplicate Post] Fully Multisite compatible? anyone using on Multisite network enabled?](https://wordpress.org/support/topic/fully-multisite-compatible-anyone-using-on-multisite-network-enabled/)
 *  [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/fully-multisite-compatible-anyone-using-on-multisite-network-enabled/#post-7215607)
 * tax_query fixed it. Thanks for the tip about the deprecated code [@lopo](https://wordpress.org/support/users/lopo/).
 * So to answer OPs question, yes working fine on multisite.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Yoast Duplicate Post] Fully Multisite compatible? anyone using on Multisite network enabled?](https://wordpress.org/support/topic/fully-multisite-compatible-anyone-using-on-multisite-network-enabled/)
 *  [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/fully-multisite-compatible-anyone-using-on-multisite-network-enabled/#post-7215603)
 * Hi,
 * I’m using it on a multisite and may have come across a problem.
 * I have a custom post type. After cloning a post the original becomes unavailable
   to get_post().
 * Here’s an example:
 * You can see both products in search results (the version with ‘NRC/CAC’ in the
   name is the clone):
    [http://www.globalgreentag.com/?archive_template=search.php&s=Fissured&post_type=products](http://www.globalgreentag.com/?archive_template=search.php&s=Fissured&post_type=products)
 * Here is a single page template for the CPT ‘manufacturers’ with a get_post() 
   at the bottom to display posts from the CPT ‘products’ based on a taxonomy. Only
   the clone ‘NRC/CAC’ is shown:
    [http://www.globalgreentag.com/manufacturer/armstrong-world-industries-ceiling-division/](http://www.globalgreentag.com/manufacturer/armstrong-world-industries-ceiling-division/)
 * This product is missing (the original):
    [http://www.globalgreentag.com/products/fine-fissured-fine-fissured-planks-and-fine-fissured-high-nrc/](http://www.globalgreentag.com/products/fine-fissured-fine-fissured-planks-and-fine-fissured-high-nrc/)
 * In the search results you can see they both have the same manufacturer (taxonomy)
   so they should both appear on the manufacturer page above.
 * We have numerous examples and the common thread is that it’s the original that
   goes m.i.a.
 * Here’s a copy of my get_post() code that I’m using on my single manufacturer 
   template :
 *     ```
       <?php
       global $post;
       $slug = get_post( $post )->post_name;
   
       $manproducts = get_posts( array(
       	'numberposts' => -1, // we want to retrieve all of the posts
       	'post_type' => 'products',
       	'manufacturer' => $slug,
       	'suppress_filters' => false
       ) );
   
       if( $manproducts ) {
          ?><h3>Products</h3>
       <div class="post-grid">
       <div class="grid-items">
       <?php
             foreach ( $manproducts as $manproduct ) {
                ?><div class="item">
       <div class="layer-media">
       			<?php if ( has_post_thumbnail( $manproduct->ID ) ) { ?>
       				<a href="<?php echo get_permalink( $manproduct->ID ) ?>" title="<?php echo get_the_title( $manproduct->ID ); ?>">
       					<?php echo get_the_post_thumbnail( $manproduct->ID, 'medium' ); ?>
       				</a>
       			<?php } ?>
       </div>
       <div class="layer-content">
       <h4><a href="<?php echo get_permalink( $manproduct->ID ) ?>" title="<?php echo get_the_title( $manproduct->ID ); ?>"><?php echo get_the_title( $manproduct->ID ); ?></a></h4>
       </div>
       </div>
   
       <?php
             }
          ?>
       </div>
       </div>
       <?php
       }
   
       wp_reset_query();
       ?>
       ```
   
 * FYI – I’m using the plugin CPT-onomies to create the ‘manufacturer’ CPT and Taxonomy.
 * Any ideas?
 * Thanks!
    – Duncan
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Show posts with the same tags as the current page](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/)
 *  Thread Starter [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [13 years ago](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/#post-3913371)
 * Hi bcworkz.
 * I got fed up and went on holiday, and with a fresh mind I’ve thought of a completely
   different way to achieve what we need. It’s a shame we didn’t resolve my original
   problem but hopefully someone will find use in this thread. Thank you for your
   help!
 * My solution:
 * I’ve added two custom fields to post_tags, an image (logo) and a custom URL for
   the page I want to link to (custom fields were added using plugin Ultimate Taxonomy
   Manager).
 * Then I can simply call the tags from the main post, including the custom URL,
   and display a list of links to those pages. This approach works for us because
   we’re only displaying a list of brand names which rarely change, so maintaining
   this is simple enough.
 * See it in action (at bottom of page):
    [http://www.livingsound.com.au/residential/smart-home-automation/](http://www.livingsound.com.au/residential/smart-home-automation/)
 *     ```
       // Display a list of post_tags with a custom link and logo, if the custom URL is set (the custom fields 'logo' and 'custom_url' were added to post_tags using Ultimate Taxonomy Manager plugin)
   
       global $post;
   
       $tags = wp_get_post_terms( $post->ID , 'post_tag' );
       if ($tags) {
         echo "<table>";
         foreach ($tags as $tag) {
           $customurl = xydac_cloud('post_tag', $tag->slug, 'custom_url');
           if (!empty($customurl)) {
       ?>
       			<tr>
       			<td width="170" class="brand-logo-td">
       			<a href="<?php echo xydac_cloud('post_tag', $tag->slug, 'custom_url'); ?>" rel="bookmark" title=""><img src="<?php echo xydac_cloud('post_tag', $tag->slug, 'logo'); ?>" border="0" alt=""></a>
       			</td>
       			<td>
               	<h3><a href="<?php echo xydac_cloud('post_tag', $tag->slug, 'custom_url'); ?>" rel="bookmark" title=""><? echo $tag->name;?> » </a></h3>
       			</td>
       			</tr>
       <?php
           }
         }
         echo "</table>";
       }
       ```
   
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Show posts with the same tags as the current page](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/)
 *  Thread Starter [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/#post-3913288)
 * BTW – may latest code is not showing any posts (bottom of page):
    [http://www.livingsound.com.au/residential/smart-home-automation/](http://www.livingsound.com.au/residential/smart-home-automation/)
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Show posts with the same tags as the current page](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/)
 *  Thread Starter [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/#post-3913287)
 * Hi bcworks. You are a true teacher. 🙂
 * I’ve made the changes you suggested (and learnt more about arrays along the way).
 * Unfortunately it’s still not working and I can’t understand why.
 * I’ve changed to arrays and I took your point about mixing strings and arrays 
   and have changed the post_type to an array also: array(‘brand’);
 *     ```
       global $post;
   
       $found_none = '<h2>No related posts found!</h2>';
       $do_not_duplicate = array();
       $do_not_duplicate[] = $post->ID;
       $tags = wp_get_post_terms( $post->ID , 'post_tag' );
       if ($tags) {
         $tag_array = array();
         foreach( $tags as $tag ) {
           $tag_array[] = $tag->term_id; // save the id in the array
         }
         foreach ($tags as $tag) {
           $myargs=array(
             'tag__in' => $tag_array,
             'post__not_in' => $do_not_duplicate,
             'post_type' => array('brand'),
             'posts_per_page'=>-1,
             'caller_get_posts'=>1
           );
           $my_query = new WP_Query($myargs);
           if( $my_query->have_posts() ) :
             while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate[] = $post->ID; ?>
               <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
               <?php $found_none = '';
             endwhile;
       	  wp_reset_postdata();
       	endif;
         }
       }
       if ($found_none) {
       echo $found_none;
       }
       wp_reset_query(); // to use the original query again
   
       print_r($tag_array); // for testing purposes to check tag ID array is working
       ```
   
 * Maybe it’s time for the teacher to take over. 😉
 * Thanks for all your help so far! We must be close!
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Show posts with the same tags as the current page](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/)
 *  Thread Starter [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/#post-3913263)
 * Thanks for those tips. I’ve tried avoiding global $post and in the loop I replaced
   $post with $brand but they had no effect.
 * I’ve also tested WP_Query instead of get_posts() but the result was the same.
 * Before digging into query.php I’ve tried a new approach using ideas from [this post](http://wordpress.org/support/topic/related-posts-by-custom-taxonomy?replies=16#post-1507261)(
   MichaelH again).
 * I am now getting a list of all the posts from the post_type ‘brand’, which means
   post_type is being recognised which is great. But when I try to include a list
   of tags from the global $post nothing is shown. I’ve tried different [WP_Query tag parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Tag_Parameters)
   like tag, tag_id, tag_slug__in, etc.
 * Can you see any obvious problems in the code below that would create a problem
   with the tag__in bit? (note: tag__in is commented out at the moment because with
   it the output is ‘No related posts found!’. You can see this code in action [here](http://www.livingsound.com.au/residential/smart-home-automation/))
 *     ```
       global $post;
   
       $found_none = '<h2>No related posts found!</h2>';
       $post_types = 'brand';
       $do_not_duplicate[] = $post->ID;
       $tags = wp_get_post_terms( $post->ID , 'post_tag' );
       if ($tags) {
         $tag_array = array();
         foreach( $tags as $tag ) {
           $tag_array[] = $tag->term_id; // save the id in an array
         }
         $tag_string = implode(", ",$tag_array);
         foreach ($tags as $tag) {
           $myargs=array(
           //  'tag__in' => array($tag_string),
             'post__not_in' => $do_not_duplicate,
             'post_type' => 'brand',
             'showposts'=>-1,
             'caller_get_posts'=>1
           );
           $my_query = new WP_Query($myargs);
           if( $my_query->have_posts() ) :
             while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate[] = $post->ID; ?>
               <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
               <?php $found_none = '';
             endwhile;
       	  wp_reset_postdata();
       	endif;
         }
       }
       if ($found_none) {
       echo $found_none;
       }
       wp_reset_query(); // to use the original query again
   
       echo $tag_string; // for testing purposes to check tag IDs are working
       ```
   
 * I did a further test which was to replace the WP_Query loop above with the get_posts()
   loop from my previous attempt and I think you are correct in assuming get_posts()
   is mishandling the arguments because post_type ‘brand’ was ignored again, with
   get_posts() and instead I got a long list of the global post title.
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Show posts with the same tags as the current page](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/)
 *  Thread Starter [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/#post-3913240)
 * Hi bcworkz
 * I went looking for an existing plugin that did what I needed but still couldn’t
   find anything.
 * So I’ve returned to my code and come up with this. I’m a bit closer now but it’s
   still not working:
 *     ```
       global $post;
         $tags = get_the_tags(); // get an array of all the tags as objects.
         $tag_array = array();
         foreach( $tags as $tag ) {
           $tag_array[] = $tag->term_id; // save the id in an array
         }
         $tag_string = implode(",",$tag_array);
         $myargs = array(
       	'tag__in' => array($tag_string),
       	'post_type' => 'brand',
           'showposts'=>-1,
           'caller_get_posts'=>1
           );
               $brands = get_posts( $myargs );
   
               // The Loop
               foreach ($brands as $post) : setup_postdata($post);
                   echo '<p>';
                       the_title();
                   echo '</p>';
               endforeach;
   
               // Reset Post Data
                   wp_reset_postdata();    
   
       echo $tag_string; // for testing purposes to check tag IDs are working
       ```
   
 * As you can see I’m extracting the post IDs properly now, and passing them to 
   tag__in. The echo at the bottom shows my tag IDs are working.
 * The problem is the argument ‘post_type’ appears to be ignored by the loop. Instead
   I’m getting only a repeat of the current page (a ‘page’). See the bottom of:
   
   [http://www.livingsound.com.au/residential/smart-home-automation/](http://www.livingsound.com.au/residential/smart-home-automation/)
 * I wonder if the problem is that my global $post is a ‘page’? I’ve enabled tags
   for pages using this plugin:
    [http://wordpress.org/plugins/tag-pages/](http://wordpress.org/plugins/tag-pages/)
 * This person wonders if post_type being ignored is a bug:
    [http://wordpress.org/support/topic/post_type-is-ignored-when-i-include-tag_in-in-my-get_posts-query](http://wordpress.org/support/topic/post_type-is-ignored-when-i-include-tag_in-in-my-get_posts-query)
 * Thanks for you help! I’m way in over my head now!
 * – Duncan
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: ["post_type" is ignored when I include "tag__in" in my get_posts query](https://wordpress.org/support/topic/post_type-is-ignored-when-i-include-tag_in-in-my-get_posts-query/)
 *  [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/post_type-is-ignored-when-i-include-tag_in-in-my-get_posts-query/#post-3024210)
 * I’m having this problem too. Did you find a resolution to this?
 * My code is a bit more complex but the effect is the same. I’ve tried get_posts
   and WP_Query loops to no avail.
 *     ```
       // List posts from a custom post type, that share tags with the current post
         global $post;
         $tags = get_the_tags(); // get an array of all the tags as objects.
         $tag_array = array();
         foreach( $tags as $tag ) {
           $tag_array[] = $tag->term_id; // save the id in an array
         }
         $tag_string = implode(",",$tag_array);
         $myargs = array(
       	'post_type' => 'brand',
       	'tag__in' => array($tag_string),
           'showposts'=>-1,
           'caller_get_posts'=>1
           );
               $brands = get_posts( $myargs );
   
               // The Loop
               foreach ($brands as $post) : setup_postdata($post);
                   echo '<p>';
                       the_title();
                   echo '</p>';
               endforeach;
   
               // Reset Post Data
                   wp_reset_postdata();
       ```
   
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Show posts with the same tags as the current page](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/)
 *  Thread Starter [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/show-posts-with-the-same-tags-as-the-current-page/#post-3913234)
 * I’m searching for a plugin option. Something like this would be great if it supported
   Custom Post Types:
    [http://wordpress.org/plugins/posts-by-tag/](http://wordpress.org/plugins/posts-by-tag/)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Posts By Tag] Custom Post Types](https://wordpress.org/support/topic/custom-post-types-28/)
 *  [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/custom-post-types-28/#post-3201909)
 * Great plugin! Please accept my vote for CPT support.
    Thanks.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form 7] [Plugin: Contact Form 7] No tag choices and No form titles](https://wordpress.org/support/topic/plugin-contact-form-7-no-tag-choices-and-no-form-titles/)
 *  [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-no-tag-choices-and-no-form-titles/#post-2543304)
 * Same for me.
    I’ve just installed CF7 3.1 on WP 3.2.1 multisite.
 * Until there is a fix for this tags can be created the old fashioned way. Instructions
   are here:
    [http://contactform7.com/tag-syntax/](http://contactform7.com/tag-syntax/)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form 7] [Plugin: Contact Form 7] Generate Tags show "Undefined" and don't works](https://wordpress.org/support/topic/plugin-contact-form-7-generate-tags-show-undefined-and-dont-works/)
 *  [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-generate-tags-show-undefined-and-dont-works/#post-2543891)
 * Same for me.
 * I’ve just installed CF7 3.1 on WP 3.2.1 multisite.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Mailing List] Mailing List Plugin settings not there in 3.3.1](https://wordpress.org/support/topic/mailing-list-plugin-settings-not-there-in-331/)
 *  Thread Starter [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/mailing-list-plugin-settings-not-there-in-331/#post-2511418)
 * I’ve fixed it. There was a conflict with WP Example Content plugin, which I have
   now deactivated, and Mailing List settings have appeared in the Dashboard. 🙂
 * [Here’s a post](http://wordpress.org/support/topic/plugin-theme-my-login-cant-adjust-settings-in-wordpress-33?replies=18#post-2528899)
   about a similar issue which led me to the solution.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Quick Post Widget] [Plugin: Quick Post Widget] Checklist Problem fixed](https://wordpress.org/support/topic/plugin-quick-post-widget-checklist-problem-fixed/)
 *  [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-quick-post-widget-checklist-problem-fixed/#post-2295087)
 * I’ve just remembered that you need to be logged in to see the form!
 * Here’s a screengrab so you can see what I’m talking about:
    [http://publishbluemountains.com.au/images/screenshot.jpg](http://publishbluemountains.com.au/images/screenshot.jpg)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Quick Post Widget] [Plugin: Quick Post Widget] Checklist Problem fixed](https://wordpress.org/support/topic/plugin-quick-post-widget-checklist-problem-fixed/)
 *  [dunc](https://wordpress.org/support/users/dunc/)
 * (@dunc)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-quick-post-widget-checklist-problem-fixed/#post-2295086)
 * [http://publishbluemountains.com.au/bl-form-test/](http://publishbluemountains.com.au/bl-form-test/)
 * Both the ‘Categories’ checklist and my custom taxonomy checklist ‘Listing Categories’
   show the HTML code.
 * Drop-down menus are fine.
 * Quickpost Widget 1.9 (downloaded today)
    I’m using WP 3.2.1 in multisite Buddypress
   1.2.9
 * Thanks! 🙂

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/users/dunc/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/dunc/replies/page/2/?output_format=md)