Metabox Data not saving

I tried your code and it saved the custom fields just fine. The issue is that esc_attr returns a string but does not echo it out. Try this instead: <p>Date: <input type=”text” name=”getextra_mbe_date” value=”<?php echo esc_attr( $getextra_mbe_date); ?>” /></p> <p>Time: <input type=”text” name=”getextra_mbe_time” value=”<?php echo esc_attr( $getextra_mbe_time); ?>” /> </p>

Add additional metafields based on value of select box

Create your metaboxes as you normally would, they will be visible by default. Then use js to hide the ones you dont want initially visible. Your code would look something like below. The example is for a checkbox, but you will get the idea how it works. if ( $(‘input#_cmb_metaboxid_1’).is(‘:checked’) ) { $(‘#metabox_id_2’).show(); } else … Read more

Query a Custom Post Type to another CPT via Metabox

You’ll want to create a standard metabox via the official APIs, how to do that is beyond this answer, what I’ll talk about is your dropdown. What you need to save is the Post ID of the building, so something like this pseudocode: <?php $current_building=….; ?> <select name=”….”> <?php $query = new WP_Query( array( ‘post_type’ … Read more

show title if one of post meta exist

I prefer below way, $fb = get_post_meta($post->ID, ‘ecpt_facebookpage’, true); $twitter = get_post_meta($post->ID, ‘ecpt_facebookpage’, true); //etc… if($fb != “” || $twitter != “” || $instagram = “”){ echo “Follow Us On”; if($fb != “”){ ?> <a target=”_blank” href=”http://www.facebook.com/<?php echo $fb; ?>”> <img src=”<?php bloginfo(‘template_url’); ?>/images2/service-fb.png” width=”25px” height=”33px” alt=”” align=”right”> </a> <?php } // And so on….. … Read more

Selecting a dynamic sidebar via metabox in wordpress

Your code seems a little superfluous; I’m pretty sure you could compact it to simply: <?php do_action( ‘before_sidebar’ ); if ( ! $sidebar = get_post_meta( get_the_ID(), ‘_cmb_test_select’, true ) ) $sidebar=”sidebar-1″; // Default sidebar if meta value does not exist. if ( ! dynamic_sidebar( $sidebar ) ) : ?> <!– No widgets for selected sidebar, … Read more

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