• crismdq

    (@crismdq)


    Hi!

    I like the thumbnail gallery navigation system, but preffer text links for that, “previous” and “next”.

    What is the code to replace the thumbnails for text links?

    Regards
    Cristian

Viewing 6 replies - 1 through 6 (of 6 total)
  • japanwindow

    (@japanwindow)

    I have the same request — text links or simple arrows would be much better than the thumbs IMO.

    There are instructions on how to add text gallery navigation here.

    Hi

    I have used Michael Field’s method to substitute the thumbnail links by text links.

    Since his site seems to be down, my tuturial about adding the gallery functionality to THE MORNING AFTER theme includes his text link based navigation.

    The main part of his code must be placed in the image.php:

    <?php mf_previous_image_link( ‘« Previous image’ ) ?> – <?php mf_next_image_link( ‘Next image »’ ) ?>

    and the functions.php:

    function mf_previous_image_link( $link_text ) {
        print mf_adjacent_image_link( $link_text, true );
    }
    
    function nb_next_image_link( $link_text ) {
        print nb_adjacent_image_link( $link_text, false );
    }
    
    function nb_adjacent_image_link( $link_text, $prev = true ) {
        global $post;
        $post = get_post($post);
        $attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby=\"menu_order ASC, ID ASC\""));
    
        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;
    };

    Everything worked / works fine with WordPress 2.5.x…

    Now, I have installed WordPress 2.6 beta1 on my test server, and I get the following errors when I open an image page:

    Warning: array_values() [function.array-values]: The argument should be an array in G:\www\WordPress-Test\wp-content\themes\tma\functions.php on line 13

    Warning: Invalid argument supplied for foreach() in G:\www\WordPress-Test\wp-content\themes\tma\functions.php on line 15
    —
    Warning: array_values() [function.array-values]: The argument should be an array in G:\www\WordPress-Test\wp-content\themes\tma\functions.php on line 13
    
    Warning: Invalid argument supplied for foreach() in G:\www\WordPress-Test\wp-content\themes\tma\functions.php on line 15

    Any suggestions?

    I created a plugin that does this:: It’s linked here.

    Nick,
    Hi. Sorry that my site was down for so long – domain issues…
    I have released plugins for both WordPress 2.5.1 and 2.6 beta 1 which can be found here: http://mfields.org/wordpress-plugins/text-based-image-links/

    Kudos to you, Michael!

    I’ve installed it on my test server.. and it worked like a charm!

    Due to this functioning plug-in, I decided to go live with WordPress 2.6 beta-3… Works like a charm, as well.

    cheers,
    Nick

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Gallery navigation in text mode’ is closed to new replies.