Title: danalydesign's Replies | WordPress.org

---

# danalydesign

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

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

 Search replies:

## Forum Replies Created

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

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

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Meta Description/Excerpt](https://wordpress.org/support/topic/meta-descriptionexcerpt/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/meta-descriptionexcerpt/#post-3874903)
 * Awesome! You ARE the man.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Meta Description/Excerpt](https://wordpress.org/support/topic/meta-descriptionexcerpt/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/meta-descriptionexcerpt/#post-3874834)
 * Thank you, sir. Now if I want to trim the meta down to only 160 characters from
   this code what would I do?
    `echo strip_tags(get_the_excerpt($post->ID));`
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Get posts from category – exclude current post](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/#post-3729236)
 * it’s returning the proper post id – I can’t get this thing to work at all.
    Display
   all posts related to category but do not include the currently displayed post
   in the list:
 *     ```
       <ul>
                           <?php $post_categories = wp_get_post_categories( $post->ID ); ?>
                           <?php $query = array ( 'post_type' => 'community', 'category__in' => $post_categories, 'posts_per_page' => 5 ); ?>
                           <?php $queryObject = new WP_Query($query); ?>
                           <?php if ($queryObject->have_posts()) : while ($queryObject->have_posts()) : $queryObject->the_post(); ?>
                           <li><a href="<?php echo get_permalink(); ?>"><?php if (strlen($post->post_title) > 22) { echo substr(the_title($before = '', $after = '', FALSE), 0, 22) . '...'; } else { the_title();} ?></a></li>
                           <?php endwhile; else: ?>
                           <li>No related resources found.</li>
                           <?php endif; ?>
                           <?php wp_reset_query(); ?>
                           <li class="last"><i class="icon-circle-arrow-right"></i> <a href="/community/category/sleep/">View All Resources</a></li>
                         </ul>
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Get posts from category – exclude current post](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/#post-3729233)
 * a thought: would this have anything to do with the fact that I’m pulling from
   a sub category?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Hide code if no posts are found?](https://wordpress.org/support/topic/hide-code-if-no-posts-are-found/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/hide-code-if-no-posts-are-found/#post-3735879)
 * keesiemeijer, no matter what anyone saysd about you – I know that you ARE the
   man! Thanks for keeping me sane!
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Get posts from category – exclude current post](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/#post-3729212)
 * > is that ‘list module’ directly coded into single.php or done with a function
   > or widget?
 * This is a chunk of code in my custom taxonomy single page: single-taxonomy.php
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Get posts from category – exclude current post](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/#post-3729211)
 * I used this
    `<?php $query = array ( 'post_type' => 'affiliates', 'affiliatetype'
   => 'apps', 'category__in' => $post_categories, 'posts_per_page' => 4, 'post__not_in'
   => array( $post->ID ) ); ?>`
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Get posts from category – exclude current post](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/#post-3729208)
 * I found this back 3 years ago on here:
 *     ```
       <?php
       $yourcat = 373; // Stick the ID here and it'll be placed in the relevant places below.
   
       if( in_category( $yourcat ) ) :
       	$my_query = new WP_Query(array(
       		'showposts' => 3,
       		'orderby' => 'rand',
       		'cat' => $yourcat,
       		'post__not_in' => array($post->ID)
       	)); unset($yourcat);
       	while ($my_query->have_posts()) : $my_query->the_post();
       	?>
       		<a href="<?php the_permalink(); ?>"><img src="<?php echo p75GetThumbnail($post->ID, 100, 100); ?>"></a>
       	<?php
       	endwhile;
       endif;
       ?>
       ```
   
 * how could i incorporate this into my code:
 *     ```
       <ul class="icons">
       					  <?php $post_categories = wp_get_post_categories( $post->ID ); ?>
                             <?php $query = array ( 'post_type' => 'articles', 'articletype' => 'news', 'category__in' => $post_categories, 'posts_per_page' => 4 ); ?>
                             <?php $queryObject = new WP_Query($query); ?>
                             <?php if ($queryObject->have_posts()) : while ($queryObject->have_posts()) : $queryObject->the_post(); ?>
                             <li class="icon-file"><a href="/articles/<?php echo basename(get_permalink()); ?>/"><?php if (strlen($post->post_title) > 33) { echo substr(the_title($before = '', $after = '', FALSE), 0, 33) . '...'; } else { the_title();} ?>
                               </a></li>
                             <?php endwhile; else: ?>
                             <li>No research articles found.</li>
                             <?php endif; ?>
                             <?php wp_reset_query(); ?>
                           </ul>
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Get posts from category – exclude current post](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/get-posts-from-category-exclude-current-post/#post-3729207)
 * alchymyth, I appreciate your input but this does not seem to be working. When
   I’m viewing the single post, in my list module (which pulls the lates 4 post 
   in the same category) this single post is still displaying as a link even though
   I’m viewing it. This is something that is happening on a global basis.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [hide block of code if featured image exists](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/#post-3694240)
 * Thank you for your attention, James. Appreciated.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [hide block of code if featured image exists](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/#post-3694239)
 * Actually jsut figured it out:
 *     ```
       <?php if( has_post_thumbnail() ) { ?>
   
       CODE ABOVE GOESW HERE
   
       <?php } else { ?>
   
       NO CODE
   
       <?php } ?>
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [hide block of code if featured image exists](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/#post-3694236)
 * it displays the image and widget whether there is a featured image or not. I 
   want to hide this entire block of code IF there is no featured image.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [hide block of code if featured image exists](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/#post-3694229)
 * No, it’s the correct code. Running this code above produces the image and widget.
   No link as it is an internal website not open to the public.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [hide block of code if featured image exists](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/#post-3694226)
 * This block of code basically displays an image and a widget. If there is no featured
   thumbnail, we want to hide this vblock of code so that the content (text) from
   the post moves up directly under the title.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [hide block of code if featured image exists](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/)
 *  Thread Starter [danalydesign](https://wordpress.org/support/users/danalydesign/)
 * (@danalydesign)
 * [13 years ago](https://wordpress.org/support/topic/hide-block-of-code-if-featured-image-exists/#post-3694222)
 * yes, our main website

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

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