{"id":57980,"date":"2011-10-02T14:29:37","date_gmt":"2011-10-02T18:29:37","guid":{"rendered":"http:\/\/wpmu.org\/?p=57980"},"modified":"2012-10-25T15:56:03","modified_gmt":"2012-10-25T19:56:03","slug":"daily-tip-how-to-include-or-exclude-images-from-the-wordpress-gallery","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/daily-tip-how-to-include-or-exclude-images-from-the-wordpress-gallery\/","title":{"rendered":"How to Include or Exclude Images From the WordPress Gallery"},"content":{"rendered":"<p>There are many ways that you can customize the native <a title=\"WordPress Gallery shortcode\" href=\"http:\/\/codex.wordpress.org\/Gallery_Shortcode\" rel=\"noopener\" target=\"_blank\">WordPress gallery shortcode<\/a>. If you just use the <b>gallery<\/b> shortcode by itself, the default behavior is to include all of the images attached to a post.<\/p>\n<p>But what if you want to limit the gallery to only a few specific images? For example, let&#8217;s say you want to show a small gallery of food pictures?<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57989\" title=\"gallery\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2011\/10\/gallery.png\" alt=\"Post image\" aria-hidden=\"true\" width=\"627\" height=\"218\" \/><\/p>\n<p>Here&#8217;s a couple quick ways to customize the WordPress gallery shortcode.<\/p>\n<h3>How to Exclude Specific Images:<\/h3>\n<p>If you want to include all images attached to a post, with the exception of a select few, you can use &#8220;exclude=&#8221; in the shortcode, followed by comma separated attachment IDs:<\/p>\n<div id='gallery-1' class='gallery galleryid-57980 gallery-columns-3'><div class='cgrid-row cgrid-row-3-col clearfix'><dl class='gallery-item cgrid-col'>\n\t\t\t<dt class='gallery-icon'>\n\t\t\t\t<a href='https:\/\/wpmudev.com\/blog\/daily-tip-how-to-include-or-exclude-images-from-the-wordpress-gallery\/wordpress-gallery\/' rel=\"lightbox\"><img loading=\"lazy\" decoding=\"async\" width=\"215\" height=\"147\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2011\/10\/wordpress-gallery.jpg\" class=\"attachment-215x9999 size-215x9999\" alt=\"wordpress gallery\" aria-hidden=\"true\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item cgrid-col'>\n\t\t\t<dt class='gallery-icon'>\n\t\t\t\t<a href='https:\/\/wpmudev.com\/blog\/daily-tip-how-to-include-or-exclude-images-from-the-wordpress-gallery\/gallery-6\/' rel=\"lightbox\"><img loading=\"lazy\" decoding=\"async\" width=\"215\" height=\"75\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2011\/10\/gallery.png\" class=\"attachment-215x9999 size-215x9999\" alt=\"gallery\" aria-hidden=\"true\" \/><\/a>\n\t\t\t<\/dt><\/dl><\/div>\n\n<h3>How to Include Specific Images:<\/h3>\n<p>If you want to include only a few specific images, then you will want to use the &#8220;include=&#8221; option in the gallery shortcode, followed by comma separated attachment IDs:<\/p>\n\n<p><b>Important Note:<\/b> You cannot use the &#8220;include=&#8221; and the &#8220;exclude=&#8221; together. Select one or the other for the most efficient way to show the exact photos that you want to display.<\/p>\n<p>For more information make sure to check out the <a title=\"WordPress Gallery shortcode\" href=\"http:\/\/codex.wordpress.org\/Gallery_Shortcode\" rel=\"noopener\" target=\"_blank\">Gallery Shortcode<\/a> page on the WordPress codex.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use these simple shortcode options to customize your WordPress gallery.<\/p>\n","protected":false},"author":4099,"featured_media":58001,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[263],"tags":[390,4645],"tutorials_categories":[],"class_list":["post-57980","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-code","tag-galleries"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/57980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/4099"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=57980"}],"version-history":[{"count":1,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/57980\/revisions"}],"predecessor-version":[{"id":216566,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/57980\/revisions\/216566"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/58001"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=57980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=57980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=57980"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=57980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}