• 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:
    https://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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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 …

    Thread Starter Christine Rondeau

    (@crondeau)

    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Feedback on code for get attachment link code snippet’ is closed to new replies.