Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Hello,

    To display an attachment image, please try [content field="image"] or [field image]. For thumbnails, you can add: size="thumbnail".

    The description is under the Gallery tab in the documentation – not very intuitive.. I’ll try to find a better place so it can be found easier.

    Come to think of it, the code you wrote makes sense, to use just [content] for an attachment image. I’ll add that functionality in the next update, so it displays the image by default when in an attachment loop.

    Sorry for the late reply, I was on vacation and offline for 4~5 days, unusual for me!

    Plugin Author Eliot Akira

    (@miyarakira)

    In the latest update, I’ve made several improvements for displaying attachments.

    You can use the code just as you described, or with the new [attached] shortcode:

    [attached]
        [content]
    [/attached]

    This will display all attachment images of the current post.

    The [attached] shortcode can be used inside a query loop, for example:

    [loop type="post" category="special"]
        [field title]
        [attached]
            [field thumbnail]
        [/attached]
    [/loop]

    For details, please refer to the documentation, under Settings -> Custom Content -> Attach.

    Thread Starter petroglyphic

    (@petroglyphic)

    Thank you, these are working.
    I’m actually trying to display links to documents attached to other pages. (The other pages are a way to organize the documents.) I’m using:

    [loop type="page" id=18622]
        [attached]
            <a href="[field url]" target="_blank">[field title]</a>
        [/attached]
    [/loop]

    This displays the titles correctly, but I can’t get the URL for the link. I tried [field url], [field image-url], [field attachment-url], [field attached-url]. The attachments are PDFs, not images. When I check the code nothing is getting called. What will call the URL?

    Also, is there a way to get rid of the empty <p> tags between items that won’t get lost when you update templates?

    Plugin Author Eliot Akira

    (@miyarakira)

    You’re right, I hadn’t tested with PDF files as attachments. Please see the latest update, [field url] should now display the attachment file URL.

    About unwanted <p> tags: WordPress auto-formats the content of the post editor using the wp_autop filter. This can cause unwanted <p> and <br> tags around line breaks. To prevent this, you can go to Settings -> Custom Content, and under the Settings tab, enable: Move wp_autop to after shortcodes.

    After this, you can insert line breaks where needed, for example:

    [loop type="page" id="18622"]
        [attached]
            <a href="[field url]" target="_blank">[field title]</a><br>
        [/attached]
    [/loop]

    Please let me know if that works for you.

    Thread Starter petroglyphic

    (@petroglyphic)

    The update works. Using the code above + list tags. Next problems:
    I can’t get more than 5 results. I tried count=all, count=100, count=10, count=-1, count =”-1″.
    I can’t get orderby and order parameters to work. (Looking for title and ASC)
    For both issues I tried adding the parameters to [loop] and to [attached], neither worked.
    Thx, Susan

    Plugin Author Eliot Akira

    (@miyarakira)

    Thank you for pointing this out! Please see the latest update – now [attached] should get all attachments by default, and I added the parameters orderby and order, as well as count.

    You can use [attached orderby="title"] for your purpose. I made order=”ASC” by default for titles.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘display attachments not working’ is closed to new replies.