WordPress.org

Ready to get started?Download WordPress

Forums

Media Library Assistant
[resolved] Next Link progression through categories + slugs (8 posts)

  1. drewdrewthis
    Member
    Posted 3 weeks ago #

    Hi there!

    Really great plugin. I've been struggling for a few days now to get the next/prev links of my image pages (linked to from an MLA gallery) to maintain the chronology of from the mla-gallery they come from and to stay within the tag filters. I've read the documentation and the forum.. but I'm just not getting it right.

    Help?

    http://www.ursulavonrydingsvard.net/wp-2014/sculpture/

    pw:letmein

    https://wordpress.org/plugins/media-library-assistant/

  2. David Lingren
    Member
    Plugin Author

    Posted 3 weeks ago #

    Thanks for the good words and for posting a link to your site. I was able to get in and have a look, but I do not see next/prev links on the page I got to.

    It would be really helpful if you could post the source text of the page that generates the gallery so I could look at the [mla_gallery] shortcode(s) you have now. Is that possible?

  3. drewdrewthis
    Member
    Posted 3 weeks ago #

    Hi, I actually was able to figure out the next/prev.. I think! Now I'm working on getting it to give me the link back to gallery page. Getting the images to progress through the slugs instead of the ids is still giving me a hard time though!

    image.php page:

    <span><?php echo do_shortcode('[mla_gallery mla_output="previous_link" mla_link_text="← MLA Previous Image" attachment_category="mla-sculpture" attachment_tag="{+request:attachment_tag+}" id="{+request:current_id+}" mla_caption="{+title+}" mla_link_href="{+site_url+}?p={+attachment_ID+}&attachment_tag={+request:attachment_tag+}"]');?></span>
    <span><?php echo do_shortcode('[mla_gallery mla_output="next_link" mla_link_text="MLA Next Image → {+query:term_taxonomy_id+}" attachment_category="mla-sculpture" attachment_tag="{+request:attachment_tag+}" id="{+request:current_id+}" mla_caption="{+title+}" mla_link_href="{+site_url+}?p={+attachment_ID+}&attachment_tag={+request:attachment_tag+}"]');?></span>

    Gallery page code:

    [mla_gallery taxonomy=attachment_tag attachment_category="mla-sculpture" attachment_tag="{+request:term_id+}" mla_link_href="{+site_url+}/?p={+attachment_ID+}&current_id={+attachment_ID+}&attachment_tag={+query:attachment_tag+}&group={+query:term_taxonomy_id+}" orderby=slug order=DESC columns=0 post_parent=current ]

  4. drewdrewthis
    Member
    Posted 3 weeks ago #

    A specific example is if you are on the attachment page for 'Pietnascie' (5th image in Sculpture), and you click the next image link, it will actually jump to "Ogromna (detail)" ( 7th image) instead of the 6th image. This is, I'm assuming, because it's going in order of IDs.. I need it to maintain the order of the mla-gallery.

  5. drewdrewthis
    Member
    Posted 3 weeks ago #

    HA!! I did it. Slow and steady, I suppose. I'm still working on getting a correct short code that will print the tag name of the current image and link back to the tag gallery, if you happen to pop on here before I get it.

    Specifically:

    I want a link progression that goes:

    Sculpture Gallery --> 1990-1994 --> Image 1 --> Image 2 --> Image 3 --> 1990-1994

  6. David Lingren
    Member
    Plugin Author

    Posted 3 weeks ago #

    Congratulations on your progress (and on the site, which features beautiful work)!

    Since you are working in a WordPress template file (image.php) you have a lot of flexibility. To get the "tag name" of the current image you can try something like:

    if ( isset( $_REQUEST['attachment_tag'] ) {
        $term = get_term_by( 'slug', $_REQUEST['attachment_tag'], 'attachment_tag' );
        $term_name = $term->name;
    }

    To get the "Gallery" links at each end of the chain you can try something like:

    <span>
    <?php
    if ( isset( $_REQUEST['attachment_tag'] ) {
        $term = get_term_by( 'slug', $_REQUEST['attachment_tag'], 'attachment_tag' );
        $term_name = $term->name;
        $gallery_link = sprintf( '<a href="%1$s/sculpture/?term_id=%2$s">%3$s</a>',
            site_url(), $_REQUEST['attachment_tag'],  $term_name );
    } else {
        $gallery_link = sprintf( '<a href="%1$s/sculpture/">All</a>',
            site_url() );
    }
    
    $previous_link = do_shortcode('[mla_gallery mla_output="previous_link" mla_link_text="← MLA Previous Image" attachment_category="mla-sculpture" attachment_tag="{+request:attachment_tag+}" id="{+request:current_id+}" mla_caption="{+title+}" mla_link_href="{+site_url+}?p={+attachment_ID+}&attachment_tag={+request:attachment_tag+}"]');
    
    if ( empty( $previous_link ) ) {
        $previous_link = $gallery_link;
    }
    
    echo $previous_link;
    ?>
    </span>
    <span>
    <?php
    $next_link = do_shortcode('[mla_gallery mla_output="next_link" mla_link_text="MLA Next Image → {+query:term_taxonomy_id+}" attachment_category="mla-sculpture" attachment_tag="{+request:attachment_tag+}" id="{+request:current_id+}" mla_caption="{+title+}" mla_link_href="{+site_url+}?p={+attachment_ID+}&attachment_tag={+request:attachment_tag+}"]');
    
    if ( empty( $next_link ) ) {
        $next_link = $gallery_link;
    }
    
    echo $next_link;
    ?>
    </span>

    I haven't actually tested the above code, but you can easily find and fix any errors I've made. Let me know how it goes.

  7. David Lingren
    Member
    Plugin Author

    Posted 2 weeks ago #

    I hope the above suggestions worked out and you were able to complete your pagination link work.

    I am marking this topic resolved, but please update it if you have any problems or further questions about the code. Thanks for your interest in the plugin.

    Thank you as well for the review you posted. Good reviews and positive feedback are great motivations to keep working on the plugin and supporting its users.

  8. drewdrewthis
    Member
    Posted 1 week ago #

    David -

    Thank you so much. I was able to get everything else to work, but getting the Next/Prev Back to Index links to work within the tags was really outside of the scope of the project. If the client requests I move forward with this, or I feel so inclined, I'll dive back into and give it another go 'round. I really appreciate your help and quick replies! Again, great plugin!

Reply

You must log in to post.

About this Plugin

About this Topic