Support » Plugin: Attachments » links & strip images

  • Resolved Thanks for Replay


    Hi Jonathan,

    1st thanks for this plugin, is one of the most intensively updated plugin recently, you must work hard! So THANKS!

    Now Please can you help:

    a. how to get links working as I would like to integrate lightbox, believe or not I spend ages to find this out, nop results. So how to get attachements->image to display full image on click. I have lightbox is just the embed attachements code in template, no way for me to get work.

    b. How to strip all text boxes in post area to get just postthumbnail, there is no need at this moment to use description or title, I cant get rid of it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jonathan Christopher


    You’re very welcome.

    Have a look at the utility functions:

    Using those you can pull specific bits of information about each Attachment. I’m not sure which lightbox script you’re using but this should get you started:

    <?php $attachments = new Attachments( 'attachments' ); ?>
    <?php if( $attachments->exist() ) : ?>
        <?php while( $attachments->get() ) : ?>
            <a href="<?php echo $attachments->src( 'large' ); ?>" class="lightbox" rel="lightbox">
              <?php echo $attachments->image( 'thumbnail' ); ?>
        <?php endwhile; ?>
    <?php endif; ?>

    That will create an unordered list of thumbnails that link to the full version. You’ll likely need to customize the class of the link or the rel or whatever triggers your lightbox script. Feel free to customize the snippet more because it likely isn’t *exactly* the markup you need, but it should illustrate how to do what you’re looking to do.

    As for **b**, you can retrieve just the thumbnail with the following:

    <?php echo $attachments->image( 'thumbnail' ); ?>

    which will return a full <img / tag, but if you want just the URL to the thumbnail you can do the following:

    <?php echo $attachments->src( 'thumbnail' ); ?>

    If you have a minute I’d really appreciate a review of the plugin!

    Impressed a always by your speed & generosity.
    I will follow your instructions and if any problem will post under.

    The response for the first question is prefect, will try.

    However the second part, is my mistake to let you to misunderstanding.
    In admin, under page, where u can attached image there are 3 items after: title, description and image. I would like to see just image.

    I did try to create function based on your “plugin help page” but removing custom fields add standard wordpress media title + wyswig. + image:) Just image please.

    THANK YOU!!!

    Plugin Author Jonathan Christopher


    I see — to customize those fields you’ll need to create a new instance. That’s how you can customize the fields displayed. Here are the docs for that:

    When creating the instance, you can name it attachments and it will overwrite the default instance and use all of the data you’ve entered thus far.

    Plugin Author Jonathan Christopher


    When customizing the instance, if you use the snippet in the documentation, just remove the fields array entirely and no fields will be inserted.

    Thank you, i did remove fields but than wordpress auto replaced with media title & caption, im sure i did not get this properly. REGARDS!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘links & strip images’ is closed to new replies.