Display a post attachment depending on the caption

Can you try something along these lines and report back the result? <?php if(qtrans_getLanguage()==’en’): ?> // attachment if statement <?php else if(qtrans_getLanguage()==’fr’): ?> // attachment if statement <?php endif; ?> Technically you could omit the second else if statement and replace it just with <?php else : ?> assuming you only have two languages you … Read more

Remove wp-caption but still show the image

You’ll need to use the img_caption_shortcode filter to do this. Pretty certain the alignment of the image (floating left/right) is part of the caption so you’ll lose the ability to do that with this code. function imageOnly($deprecated, $attr, $content = null) { return do_shortcode( $content ); } add_filter( ‘img_caption_shortcode’, ‘imageOnly’, 10, 3 ); The do_shortcode … Read more

Random home page background images with caption text

First of all I don’t think that create a custom post type only for backgrounds is a right choose: backgrond are images and images already have their post type: attachment. If you have Worpress 3.5+ you can register a custom taxonomy for attachments, call it, e.g. ‘image_scope’ : register_taxonomy(‘image_scope’, ‘attachment’, $args ); for the $args … Read more

How to get the_post_thumbnail caption?

Use the shortcode handler img_caption_shortcode to render the HTML for you, though you do need to pass it a width (which we can easily get with wp_get_attachement_image_src: function wpse_138126_thumbnail_caption( $html, $post_id, $post_thumbnail_id, $size, $attr ) { if ( $post = get_post( $post_thumbnail_id ) ) { if ( $size = wp_get_attachment_image_src( $post->ID, $size ) ) $width … Read more

WP Gallery showing captions twice

It looks like your WP Jquery Lightbox plugin is generating these extra captions. Check out the source of the jquery.lightbox.js file: … cut … var s=””; if (title != ”) { s=”<span id=”titleText”>” + title + ‘</span>’; } if (caption != ”) { if (title != ”){ s += ‘<br />’; } s += ‘<span … Read more

WordPress Caption Formatting

Don’t know what was the actual problem. Using following syntax to display content solved problem. <div> <h tag><?php the_title(); ?></h tag> ………….other things like date and author <div> <?php the_content(); ?> </div> </div> Any way, thanks for everybody who tried to answer my question.

caption shortcode using image alt as caption

To remove caption text, you can override the caption short-code using below code: add_filter( ‘img_caption_shortcode’, ‘my_img_caption_shortcode’, 10, 3 ); function my_img_caption_shortcode( $empty, $attr, $content ){ $attr = shortcode_atts( array( ‘id’ => ”, ‘align’ => ‘alignnone’, ‘width’ => ”, ‘caption’ => ” ), $attr ); if ( 1 > (int) $attr[‘width’] || empty( $attr[‘caption’] ) ) … Read more

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