WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Feedback on code for get attachment link code snippet (3 posts)

  1. I was playing around with some code for one of my client's site and using the get_attachement_link.
    The examples on the codex are pretty sparse right now and I was going to add my code snippet, but would prefer to get advice first.

    This is what I have right now:
    http://pastebin.com/3MLSmVky

    I'm pulling the images attached to a page, displaying them in a list and then using jQuery just rotating through the images.

    Can anyone confirm if my code is indeed without errors? It works, so that's the main thing, but I don't want to be updating the codex with a snippet that may contain errors.

  2. Eric Mann
    Member
    Posted 3 years ago #

    The print "\n"; line isn't absolutely necessary. Yeah, it'll make your HTML markup look nicer when people use view-source, but it won't affect the rendering of the page at all and any developer tool will reformat the markup anyway.

    That said, this is pretty much the exact same code I use to look through attachments as well ...

  3. Thanks for the feedback Eric, I feel better now updating the codex. I rely so much on the examples in the codex, that I thought I would add this to it.

    When the site goes live (if it ever does) I'll write up a blog post about it too...

    Cheers

Topic Closed

This topic has been closed to new replies.

About this Topic