Jack on "[Plugin: Easy FancyBox] Caption instead of title/alt in fancybox"

ساخت وبلاگ

Edit...

To switch the two, title and caption, below the thumbs, I use this code by WP moderator Keesie.. It would be great to have options to choose what goes below the thumbs and what is shown in the fancybox.

// SWITCH CAPTION TO TITLE
add_filter('attachment_fields_to_edit', 'image_caption_to_title', 11, 2 );
function image_caption_to_title( $form_fields, $post ) { if ( substr( $post->post_mime_type, 0, 5 ) == 'image' ) { $form_fields['post_excerpt']['value'] = $post->post_title; //$form_fields['post_excerpt']['input'] = 'hidden'; } retu $form_fields;
}
add_filter( 'post_gallery', 'switch_gallery_caption_with_title', 10, 3 );
function switch_gallery_caption_with_title( $gallery, $attr, $instance ) { add_action( 'pre_get_posts', 'disable_suppress_filters' ); retu $gallery;
}
function disable_suppress_filters( $query ) { $query->set( 'suppress_filters', false ); add_filter( 'the_posts', 'switch_caption_with_title' ); retu $query;
}
function switch_caption_with_title( $posts ) { if ( !empty( $posts ) ) { foreach ( $posts as $post ) { $post->post_excerpt = isset( $post->post_title ) ? $post->post_title : ''; } } remove_action( 'pre_get_posts', 'disable_suppress_filters' ); remove_filter( 'the_posts', 'switch_caption_with_title' ); retu $posts;
}

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 51 تاريخ : پنجشنبه 9 ارديبهشت 1395 ساعت: 17:12