Get image captions for images on gallery post format metabox

Get the attachment ID and convert to a post. From there the caption is stored on the post object. $thumb_img = get_post( get_post_thumbnail_id() ); // Get post by ID echo $thumb_img->post_excerpt; // Display Caption echo $thumb_img->post_content; // Display Description In your loop it would look like: <?php if($gallery) : ?> <?php foreach($gallery as $key => … Read more

How to show post format gallery metabox image caption in the post front end

You can add to figcaption on your front-end. <?php if ( !empty( $images ) ) { foreach ( $images as $image ) { $image_post = get_post($image); $caption = $image_post->post_excerpt; echo ‘<li class=”animated fadeIn”>’, ‘<figure>’, wp_get_attachment_image( $image, ‘post-full-width’ ), ‘<figcaption>’, $caption, ‘</figcaption>’, ‘</figure>’, ‘</li>’; } } ?>

Add template meta box to category edit page?

I’m currently working on a theme framework and one of it’s classes is a custom category template class which does just what you are asking for: it adds a select field to the category edit screen that lets you select a template, just like with pages, and i just published it as a plugin Custom … Read more

Add character count to custom metabox

I assume the #feed element is the one in which you want the count value to appear? If so, change the #bgnp_metabox_tabs entry in your keyup function to #feed. EDIT: For some reason, I wasn’t seeing all the code when I first read the problem. The id of your placeholder for the character count is … Read more

Metabox saving values

First, you don’t need the <form> tags; meta boxes are already rendered inside the post edit form. Second, if a checkbox is not checked it is not sent, so isset( $_POST[‘checkbox_name’] ) return false and the custom field that stores the value of the checkbox is not update correctly. I’ve tested this code with standard … Read more

Replace the Post Excerpt Meta Box with a Field in My Custom Meta Box

Just name the field ‘excerpt’. E.g.: <textarea name=”excerpt” id=”excerpt”><?php echo esc_html( ‘$post->post_excerpt’ ); ?></textarea> <!– if it is a textarea field –> or <input name=”excerpt” id=”excerpt” value=”<?php echo esc_attr( ‘$post->post_excerpt’ ); ?>” /> <!– if it is a text field –>

multicheck box for post metabox

I took the example code you suggested and changed the following to get multicheck support: // Add this at the end of the file // A good prefix for your name prevents problems later! function wpse6513_get_meta_check( $args = array(), $current_values = array() ) { extract( $args ); $name_esc = esc_attr( $name ); if ( ! … Read more

Custom post type’s slug gets wrong when adding a custom meta box

This strange behaviour is very likely to be caused by the additional form tag you’re adding. The meta boxes are already encapsulated by a form, so adding one yourself in the meta box callback is unnecessary. Removing <form action=”<?php bloginfo(‘url’); ?>” method=”get”> and </form> should solve your issues. EDIT: Seeing as this didn’t solve your … Read more

Problem in custom meta boxes

Okay got the issue, here is the complete code that is saving data. The issues are explained at the bottom: /** * Adds a box to the main column on the Post and Page edit screens. */ function nss_mood_add_meta_box() { //$id, $title, $callback, $post_type, $context,$priority, $callback_args add_meta_box(‘nss_mood_id’,’Set your mood’,’nss_mood_cb’,’post’); } add_action(‘add_meta_boxes’,’nss_mood_add_meta_box’); // Dispalying form and … Read more

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