Hiding custom fields when content is empty [closed]

Got it! I needed to add this line: if ( $other_details = get_post_meta( $order->id, ‘Other Details’, true ) ) { So the full code for the block I needed to change would be: /** * Add the fields to order confirmation/thank you page. **/ add_action( ‘woocommerce_order_details_after_order_table’, “my_woocommerce_other_details_after_order_table”, 10, 1 ); function my_woocommerce_other_details_after_order_table( $order ) { … Read more

Advanced Custom Fields for Header that are Editable from a Page [closed]

Assuming you are working with a theme supporting the WP customizer: Using the customizer.php file (can be found in sub-folder ‘inc’, or perform a search, varies from theme to theme. Make you own = Customizer API) So, in your customizer.php – Add this: // Add to customizer.php inside function your_customizer($wp_customize) {} $wp_customize->add_setting( ‘live_in_ctc’, array( ‘default’ … Read more

Using CMB2 Plugin to create text_date metabox (datepicker) How do I save multiple dates? [closed]

In CMB2 you can use the group type to create a repeating fields, then inside the group, you declare the text_date type. Let’s say you have an Events where you set multiple dates. $events = new_cmb2_box([ ‘id’ => ‘events_metabox’, ‘title’ => __(‘Events’, ‘text_domain’), ‘object_types’ => …, ‘show_on’ => …, … ]); $events_group_id = $events->add_field([ ‘id’ … Read more

Query posts by custom fields (object post)

If you use Post Object field type, then it is stored as ID in custom field. So this should do the trick: $posts = get_posts(array( ‘numberposts’ => -1, ‘post_type’ => ‘post’, ‘meta_key’ => ‘<FIELD_NAME>’, ‘meta_value’ => <POST_ID> )); PS. You should use ‘posts_per_page’ instead of ‘numberposts’ (which is deprecated).

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