Gallery shortcode menu order fix no longer working on WordPress 4.0

What I found to work for me was to remove the action within the foreach ending with the following code function pmc_gallery_menu_order_fix($id) { $regex_pattern = get_shortcode_regex(); preg_match (“https://wordpress.stackexchange.com/”.$regex_pattern.’/s’, stripslashes($_POST[‘content’]), $regex_matches); if ($regex_matches[2] == ‘gallery’) : $attribureStr = str_replace (” “, “&”, trim ($regex_matches[3])); $attribureStr = str_replace (‘”‘, ”, $attribureStr); $attributes = wp_parse_args ($attribureStr); endif; $ids … Read more

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>’; } } ?>

Possible to add same caption to all photos in a gallery?

Gallery with the same caption to all images: Here are two different ways to achieve this dynamically, without editing the caption for each image in the gallery. If we use the custom attribute same_caption in our gallery shortcode: then we can get the same caption for that gallery. Before: After: This is independently supported by … Read more

wp_editor in add_meta_boxes does not show gallery

Make sure tinymce option has a valid value. Remove it or set it to true if you don’t pass any parameters to tinymce $editor_config = array( ‘teeny’=>true, ‘textarea_rows’=>10, ‘editor_class’=>’csec_text’, ‘textarea_name’=>’csec_body’, ‘wpautop’=>false, ‘tinymce’=>$tinymce_options //THIS OPTION SHOULD BE VALID ); Edit: Made a small research. Add wpview in plugins argument of tinymce options. $tinymce_options = array( ‘plugins’ … Read more

Calling function from within functions.php returns unwanted value

Inside this loop: foreach ( $attachments as $id => $attachment ) { $link = isset($attr[‘link’]) && ‘file’ == $attr[‘link’] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false); $output .= “<{$itemtag} class=”gallery-item”>”; $output .= “<span class=”photos-comment-number-wrap”><span class=”comment-number”>”. comments_number() .”</span></span>”; $output .= ” <{$icontag} class=”gallery-icon”> $link </{$icontag}>”; if ( $captiontag && trim($attachment->post_excerpt) ) { $output … Read more

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