Add #content to next_image_link()

This is kinda dirty, but I can’t find a better hook: function add_content_hash( $link ) { $link = str_replace(“‘ title=””, “#content” title=””, $link); return $link; } add_filter( “wp_get_attachment_link’, ‘add_content_hash’ );

WordPress Gallery not being output correctly/consistently

It looks like you have the gallery settings pointing to the attachment pages instead of the media files directly. You can try this shortcode instead of the default if you want different sizes, you can change the size parameter to size=”thumb”, size=”medium”, size=”large” or to the image-size-name you want to use.

Checking for ‘gallery’ shortcode using strpos always returns false

You will need global $post to get the $post variable into the scope of that function. function doraemon_scripts() { if( is_single() ) { global $post; if (strpos($post->post_content,'[gallery’) === false){ } else { // wp_enqueue_style( … ); // wp_enqueue_script( … ); } } } add_action( ‘wp_enqueue_scripts’, ‘doraemon_scripts’ ); Using the $post global outside of the Loop … Read more

How to dynamically insert in the image caption?

That markup is created by the caption shortcode. If you look at the the source for that shortcode you will see this: // Allow plugins/themes to override the default caption template. $output = apply_filters(‘img_caption_shortcode’, ”, $attr, $content); if ( $output != ” ) return $output; That means that you can hook a function into img_caption_shortcode … Read more

How can I attach a gallery to a post with a short code?

The gallery is the shortcode. It is not, so far as I know, saved in any other place or in any other way than in that shortcode. You can print/process shortcodes anywhere you want with tricks like this: echo do_shortcode(”); Or this: $gallery_shortcode=”‘; print apply_filters( ‘the_content’, $gallery_shortcode ); Both from the Codex. You can see … Read more

Making a [gallery] in a loop with attachment IDs?

First get all of the feature thumbnail ids, and then populate the gallery. Code – <?php global $wpdb; $featured_ids = $wpdb->get_col(“SELECT meta_value FROM $wpdb->postmeta WHERE meta_key=’_thumbnail_id'”); $featured_ids = array_map(‘intval’, $featured_ids); $featured_ids = array_unique($featured_ids); echo do_shortcode(”); ?>

Where is image gallery information saved?

WordPress doesn’t necessarily save a ton of gallery information in the database. Each time you upload an image ( or any media I believe ) it gets assigned to a built-in post type called simply “attachment” which gives it a unique ID. Whenever you go through the Media Library Popup and create a gallery, WordPress … Read more

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