[resolved] links & strip images (6 posts)

  1. Thanks for Replay
    Posted 2 years ago #

    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.


  2. Jonathan Christopher
    Plugin Author

    Posted 2 years ago #

    You're very welcome.

    Have a look at the utility functions: https://github.com/jchristopher/attachments#retrieve-attachment-attributes

    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!

  3. Thanks for Replay
    Posted 2 years ago #

    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!!!

  4. Jonathan Christopher
    Plugin Author

    Posted 2 years ago #

    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: https://github.com/jchristopher/attachments#create-custom-instances

    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.

  5. Jonathan Christopher
    Plugin Author

    Posted 2 years ago #

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

  6. Thanks for Replay
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Attachments
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.