Foreach giving one too many list items, how can I remove the last empty line?

I’ve managed to find the answer to my problem of empty custom fields showing on the page. /** Get Fitness Custom Fields from listing page **/ add_filter( ‘woocommerce_single_product_summary’, ‘something_custom_fields’, 23 ); function something_custom_fields() { //Get picture from post meta or template directory $thumb = get_post_meta($post->ID,’Thumbnail’, true); $thumb = ( !empty( $thumb ) ) ? $thumb … Read more

Can’t sort custom column on user.php by number / meta_value_num?

Instead of ‘request’ function, use this : add_action(‘pre_user_query’, ‘user_column_orderby’); function user_column_orderby($userquery){ if(‘Votes’==$userquery->query_vars[‘orderby’]) { global $wpdb; $userquery->query_from .= ” LEFT OUTER JOIN $wpdb->usermeta AS alias ON ($wpdb- >users.ID = alias.user_id) “; $userquery->query_where .= ” AND alias.meta_key = ‘wp__user_like_count’ “; $userquery->query_orderby = ” ORDER BY alias.meta_value “.($userquery->query_vars[“order”] == “ASC” ? “asc ” : “desc “); } }

update_post_meta based on acf repeater field

/** * Function: update_acf_repeater_field * Parameters: $meta_type = post|user|comment * $field_group_name = the name of ACF Field Group * $repeater_field_name = the repeater field name * $subfields = a multidimensional array with the array keys matching the * the sub field names, e.g., array(array(‘subfield_name’=>’value’,’subfield_name’=>’value’)) * $post_id = the post id, user id or comment id … Read more

How to add google map to custom field

It looks like you’re missing some code according to the ACF docs – see example under “Required CSS & JS” – http://www.advancedcustomfields.com/resources/google-map/ Sadly – this page of the ACF documentation may be out of date. According to google maps API docs – you’ll need to create an API key for all their APIs (Embed, JS, … Read more

Show only first image of multiple image field

Below are four examples of getting a list of items, returning the first and showing a single image from the first id. explode assumes your data is in a string separated by commas. get_attached_media pulls all the attached items in a post then renders the first from that list get_post_meta assumes the data lives in … Read more

Filter Query Post by Custom Fields(by date)

As already said, your query arguments are slightly off – meta_query should be an array of arrays: $query = new WP_Query( array( ‘category_name’ => ‘events’, ‘order’ => ‘DESC’, ‘orderby’ => ‘meta_value’, ‘meta_query’ => array( array( ‘key’ => ‘start_date’, ‘value’ => strtotime( ‘today’ ), ‘compare’ => ‘>=’, ‘type’ => ‘UNSIGNED’, // Ensure MySQL treats the value … Read more

How do delete a meta key?

Metas do not exist on wordpres without handles. Therefore, if you remove all handles from a meta of a given name in your Meta Data Handling section (not accessible from menu without a plugin, rather by adding a new meta key), the key will be automatically deleted.

extra post fields for url + youtube video / implementation

http://voodoopress.com/2011/03/adding-meta-boxes-to-your-post-screen/ Is a post I wrote the other day about adding meta boxes. I use it to put links in to change the link some of my post titles use. I’m not sure if this is what you are looking for exactly, as I’m not quite sure what you mean by ‘extra fields’

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