• Gallery shortcode doesn’t work,
    is it just me, or you have the same problem ??

    [gallery columns="2"]

    this is supposed to work right ?? but it doesn’t . -_-
    ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Same here. And just using a simple [gallery]

    I found a solution to this problem. Goto to this section of wp-includes/post-template.php and replace the code.

    /**
    * Retrieve an attachment page link using an image or icon, if possible.
    *
    * @since 2.5.0
    * @uses apply_filters() Calls ‘wp_get_attachment_link’ filter on HTML content with same parameters as function.
    *
    * @param int $id Optional. Post ID.
    * @param string $size Optional. Image size.
    * @param bool $permalink Optional, default is false. Whether to add permalink to image.
    * @param bool $icon Optional, default is false. Whether to include icon.
    * @return string HTML content.
    */

    function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false) {
    	$id = intval($id);
    	$_post = & get_post( $id );
    
    	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
    		return __('Missing Attachment');
    
    	if ( $permalink )
    		$url = get_attachment_link($_post->ID);
    
    	$post_title = attribute_escape($_post->post_title);
    
    	$link_text = wp_get_attachment_image($id, $size, $icon);
    
    	//modification introduced to force the gallery shortcode thumbnail hyperlink to the full size image directly, rather than the attachment page
    		$url = wp_get_attachment_url($_post->ID);
    
    	if ( !$link_text )
    		$link_text = $_post->post_title;
    
    	return apply_filters( 'wp_get_attachment_link',"<a href=$url title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon );
    }

    Make sure to backup your post-template.php file before modifying the code. Thanks to Mark Pederson for the solution.

    R

    kristina108

    (@kristina108)

    This didn’t work for me. Did it work for anyone else?

    Cheers,
    Kristina

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Gallery shortcode doesn’t work’ is closed to new replies.