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?