Add next and prev buttons in attachment page for image galleries

Posted in: Newspaper
Post count: 6

Hi,

How to add next and prev buttons in image attachment page like nextgen gallery. Is it possible do that? Need some help on this.

Regards,
Suresh

Post count: 3343

Hi,
Add this code:

<div class="alignleft"><?php previous_image_link() ?></div>
<div class="alignright"><?php next_image_link() ?></div>

like here: http://screencast.com/t/hBPGJRf05j

Thanks!

Post count: 263

@Marius, thanks this works. This code shows the previous and next image. I added Next and Previous text above the images (not linked). Is there a way to possible style this better and link the Next/Previous text?
Here is how it looks: http://screencast.com/t/t6ZqDRqjO

Post count: 854
Post count: 5

Hi,
Add this code:

<div class=”alignleft”><?php previous_image_link() ?></div>
<div class=”alignright”><?php next_image_link() ?></div>
like here: http://screencast.com/t/hBPGJRf05j

Thanks!

What I need to do is add these two lines to the file attachment.php? After the change does not display next/prev. What do I do wrong?
Mariusz

Post count: 3343

Hi,
Use this code:

<div class="alignleft"><?php previous_image_link(); ?></div>
<div class="alignright"><?php next_image_link(); ?></div>

Thanks!

Post count: 5

Hi, it does not work for me. Now I have in attachment.php:

/domain/wp-content/themes/Newspaper/

...
default:
        echo td_page_generator::wrap_start();
        ?>
            <div class="span8 column_container">
                <?php
                if (!empty($post->post_parent) and !empty($post->post_title)) {
                    echo td_page_generator::get_attachment_breadcrumbs($post->post_parent, $post->post_title);
                }

                if (is_single()) {?>
                    <h1 itemprop="name" class="entry-title td-page-title">
                            <span><?php the_title(); ?></span>
                    </h1><?php
                } else {?>
                    <h1 itemprop="name" class="entry-title td-page-title">
                        <a itemprop="url" href="<?php ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
                    </h1><?php
                }

                    get_template_part('loop', 'attachment');
                ?>
				<div class="alignleft"><?php previous_image_link(); ?></div>
				<div class="alignright"><?php next_image_link(); ?></div>
				
            </div>
            <div class="span4 column_container">
                <?php get_sidebar(); ?>
            </div>
        <?php
        echo td_page_generator::wrap_end();
        break;
...

Can I do something wrong?

This is source code from browser:

...
<div class="td-attachment-page-content">
                
            </div>
            				<div class="alignleft"></div>
				<div class="alignright"></div>		
            </div>
...
Post count: 3343

Hi,
I used the same code:
http://screencast.com/t/l4waoz4Pu9

and works fine: http://screencast.com/t/hjwaY161

Make sure you see an attachment from a post with multiple images attached.
Thanks!

Post count: 263

Her Marius,

This works great, thanks. One thing though. These show the 250×250 images. Can I display the 150×150 somehow?

Thanks!

Post count: 854

hi,

http://codex.wordpress.org/Function_Reference/previous_image_link

you can read here about this functions: http://screencast.com/t/p8kQzCkgCy

Thanks for you message.
Radu A.

Post count: 42

Ive followed these instructions and it does work to a point but the left side image seems to be pushing the right (next) down.

E.g.

http://www.heyuguys.com/peaky-blinders-season-2-trailer-photo-gallery/peaky_blinders_season_2-16/

D

Post count: 6600

Hi,

Please make sure you add this classes, like this: http://screencast.com/t/FnF2Sq6ZAct
Then use this custom css: http://screencast.com/t/BzQyV4No1S81

.alignleft {
float: left;
}
.alignright {
float: right;
}

Thanks

Post count: 42

Perfect, works a treat. Thx.

D

Post count: 220

Can u help us in creating the responsive css for the Previous … Back to Gallery …. NEXT

Here is the sample form attached

https://www.diigo.com/item/image/3bjz5/c5yr

  • This reply was modified 11 years by srikanth.
  • This reply was modified 11 years by srikanth.
Post count: 6600

Hi,

Use the Media Query Snippets from below to style the the button as you like on mobile/tablet portrait/ table landscape and desktop screens:

/* responsive phone */
@media (max-width: 767px) {
    
}
/* responsive portrait tablet */
@media (min-width: 768px) and (max-width: 1018px) {
    
}

/* responsive landscape tablet */
@media (min-width: 1019px) and (max-width: 1200px) {
    
}

/* responsive monitor */
@media (min-width: 1201px) {
    
}

Unfortunately we cannot offer custom work as we work hard on the development, updates, fixes and support. You can always get a freelancer from sites like: http://studio.envato.com/ if you don’t know how to do it yourself.

Thanks

Post count: 220

Thanks u Lucian i will work on that …

Viewing 16 posts - 1 through 16 (of 16 total)
You must be logged in to reply to this topic.