How can I filter the contents of a metafield before it’s displayed in the admin?

I have seen that CMB2 offers the possibility to create a custom escaping function with which the values are checked before they’re displayed. So I set the escape_cb parameter in the metafield this way: $cmb->add_field( array( ‘name’ => esc_html__( ‘Text Area for Code’, ‘cmb2’ ), ‘id’ => $prefix . ‘textarea_code’, ‘type’ => ‘textarea_code’, ‘sanitization_cb’ => … Read more

Sort by two dates. Default entry date and custom field if present

Few issues I see here with your code: You have category_name set to upcoming class … category slugs do not have spaces in them, so this is incorrect. If you meant to have all upcoming and class categories, then use upcoming,class https://developer.wordpress.org/reference/classes/wp_query/#category-parameters You have a meta query on company but it sounds like you’re also … Read more

Making custom field’s ‘Name’ available in the dropdown list by default in a theme?

your best option is to create a custom meta box with-in your theme and then the user will have it no matter if he typed it once before. // Hook into WordPress add_action( ‘admin_init’, ‘add_custom_metabox’ ); add_action( ‘save_post’, ‘save_custom_intro_image’ ); /** * Add meta box */ function add_custom_metabox() { add_meta_box( ‘custom-metabox’, __( ‘Intro Image’ ), … Read more

Community and User Generated Content Website: Have been thinking about Drupal but leaning on WordPress heavily

First: (Really!) get someone who understands a lot about code & wordpress. As you’ve already read Mike Schinkels site: He’s a good one. can I scale the website without worrying too much into maintaining the technical aspects of the site? If you, as i stated above, got some who makes you a solid foundation, then … Read more