display loop only if a post meta data exist

If you want to avoid preprocessing the data, this will work (though it’s definitely the quick and dirty method): <?php while (have_posts()) : the_post(); ?> <?php $data = get_post_meta( $post->ID, ‘key’, true ); ?> <?php if( $data != ” ) : ?> <!– info –> <?php endif; ?> <?php endwhile; ?> Otherwise (and this is … 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

How to query posts that have certain post meta keys, and sort by meta key and/or value

how about array_reverse() http://php.net/manual/en/function.array-reverse.php there are a bunch of array manipulation functions at php.net. i’m always there looking something up. also sort() might be useful EDIT based on your comments: sort($album); print_r($album); should return: Array ( [0] => 001,Get Rich Or Die Tryin [1] => 002,Curtis [2] => 003,The Massacre [3] => 004,Before I Self … Read more

Attaching global meta to custom fields

I think the way I would tackle this would be a non-hierarchical taxonomy. That would allow you to tag the artist and such as well as give you a few fields to work with for basic data input…you also have the ability to expand, should you need it. If you’re going to have a lot … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)