Home > blog > How to Exclude an Image from a WordPress Gallery?

Wed

23

Sep 09

How to Exclude an Image from a WordPress Gallery?

How to exclude an image from your gallery? That’s the ques­tion I’ve been ask­ing myself a few days ago. Obvi­ously, Word­Press doesn’t pro­vide a solu­tion for this action out of the box so I had to get some help. As usual, Google wasn’t shy and came up with a lot of sug­ges­tions. First, I tried to hack my functions.php accord­ing to this awe­some post from the devel­op­ment team at Code Greene. Yes, it worked out quite well but I didn’t like all the has­sle … and I kinda fried my functions.php because the pro­vided code was full of HTML enti­ties (you know, & instead of & and the like).

So, I had to look fur­ther and I stum­bled over a nice lit­tle plug-​​in called Cleaner Gallery. This plug-​​in mainly takes care of the invalid XHTML that Word­Press pro­duces when using the gallery short­code. Addi­tion­ally, it pro­vides the user with a few more fea­tures not the least of it the abil­ity to exclude or include any images from your gallery. Just install it, take a look at the pro­vided readme.html and there you go. Nice work!

Categories: blog Tags: , ,
  1. Ben­jam
    September 23rd, 2009 at 21:42 | #1

    Sorry about the HTML enti­ties in my post about hack­ing the functions.php file. Word­Press like to hack source code to pieces when you make even the tini­est edits any­where in the post.

    Any­who… I’ll check out that plu­gin you found, and clean up my post. Thanks.

  2. JC
    September 23rd, 2009 at 21:52 | #2

    First of all, thank you for pro­vid­ing the code. After I fixed the HTML enti­ties every­thing worked fine and it would’ve been enough for me. Unfor­tu­nately, I have the habit to sug­gest solu­tions to other peo­ple and while it worked quite well it wasn’t very straight-​​forward. Peo­ple with­out tech­ni­cal knowl­edge couldn’t use this solu­tion as eas­ily as oth­ers do.

    Keep up the good work.

  3. Ben­jam
    September 23rd, 2009 at 22:51 | #3

    I agree, it wasn’t a very end user friendly solu­tion, but it was built as a quick fix for myself.  Because I had never seen any­thing like it any­where else in my searches, I posted it.  But that plu­gin you sug­gested looks like a nice plu­gin for the not-​​quite-​​so-​​tech-​​savvy blog­ger.  Nice find.

  4. JC
    September 24th, 2009 at 11:03 | #4

    True enough. The good stuff stays hid­den some­where in a repos­i­tory or not very descrip­tive plug-​​in list­ing. It even took me a while to find your post.  Looks like Cleaner Gallery has been around for a time now but the abil­ity to exclude/​include images has only been added recently.

    Any­way, I never meant to rant so much. Your code works and that’s all one could wish for.

  5. October 16th, 2009 at 08:18 | #5

    hello,

    Thank you for the great qual­ity of your blog, every time i come here, i’m amazed.

    black hat­ti­tude

  6. March 15th, 2010 at 07:24 | #6

    Great blog. Can’t wait to start my own blog.rec­i­p­ro­cal link checker

  7. April 5th, 2010 at 20:16 | #7

    I use to ready our arti­cles and that’s greatn !!! ;)

    • JC
      April 15th, 2010 at 14:08 | #8

      You are wel­come! :)

  1. September 28th, 2009 at 15:11 | #1

Spam Protection by WP-SpamFree