Forums

Gallery Gap After First Line (5 posts)

  1. Webmaster4School
    Member
    Posted 3 years ago #

    I'm having some trouble with my gallery on my website. I'm pretty new to this, and for a few months all I needed to do was upload pictures to a page, and then type in [gallery] and it would display everything perfectly.

    Now I have a recurring problem that I can't seem to solve in the theme php code - after the first line of pictures, there's a space about the size of another line of pictures. Then there's a second line, and the third, fourth, etc look fine. So for instance:

    This is the first line of pictures.

    This is the second line of pictures (note the break)
    This is the third line
    This is the fourth line...etc

    Is there a quick fix for this? If you need any more information just let me know.

  2. khosman
    Member
    Posted 3 years ago #

    your site link ?

  3. Webmaster4School
    Member
    Posted 3 years ago #

    http://ssdsrv.org/about/gallery/first-day-of-school-2008-2009

    that's the link to one of our gallery pages

  4. khosman
    Member
    Posted 3 years ago #

    which one you use the plugin for gallery

  5. Webmaster4School
    Member
    Posted 3 years ago #

    I was not the person who created the website...I looked through the list of plugins, it doesn't seem to be there. What is there, however, is a function.php code inside the theme, I'll copy and paste it at the bottom. Also, I was told that the last time the problem occured, "introduced a change to ahs_adjacent_image_link() (in the theme folder in functions.php) that had been introduced in the latest WordPress upgrade", but I don't believe we've upgraded since then

    function ahs_previous_image_link( $link_text ) {
        print ahs_adjacent_image_link( $link_text, true );
    }
    
    function ahs_next_image_link( $link_text ) {
        print ahs_adjacent_image_link( $link_text, false );
    }
    
    function ahs_adjacent_image_link( $link_text, $prev = true) {
    	global $post;
    	$post = get_post($post);
    	$attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));
    
    	foreach ( $attachments as $k => $attachment )
    		if ( $attachment->ID == $post->ID )
    			break;
    
    	$k = $prev ? $k - 1 : $k + 1;
    
        if ( isset($attachments[$k]) )
            return '<a href="' . get_attachment_link( $attachments[$k]->ID ) . '">' . $link_text . '</a>';
    	else
    		return false;
    
    }

Topic Closed

This topic has been closed to new replies.

About this Topic