Sum of Custom Meta written by Authour

Maybe not the most elegant solution $authorPost = get_posts(array(‘author’ => 1));foreach ($catPost as $post) { setup_postdata($post); $ids[] = get_the_ID(); } $idList = implode(“,”, $ids); //turn the array into a comma delimited list $meta_key = ‘post_view’; $allview = $wpdb->get_var($wpdb->prepare(” SELECT sum(meta_value) FROM $wpdb->postmeta WHERE meta_key = %s AND post_id in (” . $idList . “)”, $meta_key)); … Read more

How can I modify this code to iterate over an array of categories?

In short, yes! $args = array( ‘post_type’ => ‘summerartcamp’, ‘cat’ => 15, //This is for the Morning Group – I’ll have a second loop for the Afternoon Group ‘order’ => ‘ASC’, ‘meta_key’ => ‘_expiration-date’, ‘orderby’ => ‘meta_value’ ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() /* Make sure you use the method, not … Read more

How to fix blank pagination links?

Could you go to this page for us: ../wp-admin/options-permalink.php What is the structure chosen? That will give you the answer for how to adjust the function on the bottom edit: Also, Why is this part like this: if ($echo) { echo $output; } return $output; } Shouldn’t $output be in parenthesis?

Woocommerce Price Text

Just use the $product parameter to get the custom field value, and determine what to return: function custom_price_html( $price, $product ) { if ( ( int ) get_post_meta( $product->id, ‘price_per_person’, true ) ) $price .= ‘ per person’; elseif ( ( int ) get_post_meta( $product->id, ‘price_per_group’, true ) ) $price .= ‘ per group’; $price … Read more

WordPress get_post_meta issue

First you should make some improvements to your template file. Try this: <?php get_header(); ?> <?php global $woo_options; ?> <?php if ( $woo_options[‘woo_featured_disable’] <> “true” ) include( TEMPLATEPATH . ‘/includes/featured.php’); ?> <?php $args = array( ‘post_type’ => ‘infobox’, ‘order’ => ‘DESC’, // DESC for newer first. ‘orderby’ => ‘date’, ‘posts_per_page’ => 6 // For a … Read more

Are widget arguments always set inside My_Widget::widget()?

This is mostly a case of trusting the arguments. Or not trusting. You can assume that you have received meaningful arguments, ready to be used. You can assume they are arbitrary and possibly grossly invalid. I would say in this specific case it hangs if the code is public or private. In private site you … Read more