Save Custom Fields for Variations Product

Okay, based on answers on link above (where I got the old code and there are people that help to answered), I put the modification code for my website. I tried it and it’s working like charm. Change: add_action( ‘woocommerce_product_after_variable_attributes’, ‘variable_fields’, 10, 2 ); Into : add_action( ‘woocommerce_variation_options’, ‘variable_fields’, 10, 3 ); And change : … Read more

Added 20 Custom Fields. Only 10 showing in drop down

There’s a limit set inside the function that lists the meta data. http://core.trac.wordpress.org/browser/tags/3.1/wp-admin/includes/template.php#L512 Run a filter on postmeta_form_limit to increase to your desired value, eg. add_filter( ‘postmeta_form_limit’, ‘meta_limit_increase’ ); function meta_limit_increase( $limit ) { return 50; } Hope that helps.. 🙂

query_posts and only show results if a custom field is not empty

Try this code: $args = array( ‘posts_per_page’ => ’10’, ‘post_type’ => ‘programmes’, ‘meta_key’ => ‘popularityfig’, ‘meta_value’ => ”, ‘meta_compare’ => ‘!=’, ‘order’ => ‘DESC’ ); There’re 2 arguments you might want to note in the code: meta_value and meta_compare. Using meta_compare with operator != will exclude posts with empty meta value.

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