Website that sells statistics

Well to say that these custom fields are insecure in the wp core tables is to say that the usernames and passwords are also insecure, along with any private or password protected posts. As long as you are not outputting these custom fields anywhere but a secure page for logged in, paid up users, no … Read more

Show or hide custom fields by user’s role [frontend]

Yes, it is possible to hide or show custom fields by user’s role. Use current_user_can() for finding current user role. This function returns true if current user has capability or role. For example your current user is “wholesale” then you can use like this: <?php if( current_user_can(‘wholesale’)) { ?> // stuff here for wholesale <?php … Read more

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