If more than 1 image show post link?

check how many posts were returned in your $attachments variable and output your desired markup for each case: $featured = get_post_meta($post->ID,’_thumbnail_id’,true); $attachments = get_children( ‘post_type=attachment&orderby=menu_order&exclude=”.$featured.”&post_mime_type=image&post_parent=”.$post->ID ); if( count( $attachments ) > 1 ): // more than 1 attachment else: // just 1 (or 0) endif;

How to include post count in this “get_tags” snippet

where exactly? example below is for the count getting shown in brackets after the tag name, outside the link: <?php $tags = get_tags(); if ($tags) { foreach ($tags as $tag) { echo ‘<li><a href=”‘ . get_tag_link( $tag->term_id ) . ‘” title=”‘ . sprintf( __( “View all posts in %s” ), $tag->name ) . ‘” ‘ … Read more

Query posts alphabetically within this function

You’ll need to run through get_posts() to apply the order by handling. $planIDs = get_post_meta( $post->ID, ‘_lm_comm_plans’, false ); foreach( get_posts( array( ‘post__in’ => $planIDs, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘post_type’ => ‘plans’ ) ) as $plan ) { $pdfID = get_post_meta( $planID, ‘_lm_plan_pdf’, true ); $pdfURL = wp_get_attachment_url( $pdfID ); $planTitle = get_the_title( … Read more

Can I use $query->set() (in a pre_get_posts() hook) with a custom taxonomy in WP 3?

For what it’s worth, I just gave up on the ‘__not_in’ approach and went with the following somewhat sneaky solution: //Create the exclusion rule $new_tax_query = array( array( ‘taxonomy’ => ‘x_category’, ‘field’ => ‘slug’, ‘terms’ => array(‘y-slug’), ‘operator’ => ‘NOT IN’, ) ); //If there is already a tax_query, ‘AND’ our new rule with the … Read more

How to check if custom field exists in this widget query

I can’t test it now, but the following should work… query_posts(‘post_type=sponsors&meta_key=_vof_sponsor_level&meta_value=Gold’); if (have_posts()) : echo “<div class=”imageshadow sponsorwidgetslides”>”; while (have_posts()) : the_post(); if ( get_post_meta($post->ID, ‘url’, true) ) { ?> <a href=”https://wordpress.stackexchange.com/questions/39982/<?php echo get_post_meta($post->ID,”url’,true); ?>”><?php the_post_thumbnail(‘sponsorwidget’);?></a> <?php } else { the_post_thumbnail(‘sponsorwidget’); } endwhile; echo “</div><!–/.imageshadow–>”; echo “<a class=”widgetlink” href=””; bloginfo(“url’); echo “/sponsors’>View all Sponsors &raquo;</a>”; … Read more