{"id":266,"date":"2013-01-21T13:21:45","date_gmt":"2013-01-21T13:21:45","guid":{"rendered":"http:\/\/w3bits.com\/?p=266"},"modified":"2015-05-11T17:35:59","modified_gmt":"2015-05-11T17:35:59","slug":"remove-wordpress-default-gallery-style","status":"publish","type":"post","link":"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/","title":{"rendered":"Remove the default Gallery Style in WordPress"},"content":{"rendered":"<p>We want to customize a lot of things in our WordPress themes, and WordPress gallery style can be one of those. At first, it looks like to throw some <i>CSS code<\/i> in the <span class=\"code\">style.css<\/span> and it&#8217;s done. But that alone, is not gonna work since WordPress automatically adds a default <i><abbr title=\"&lt;style type=&quot;text\/css&quot;&gt;&lt;\/style&gt;\">style<\/abbr><\/i> snippet in the post containing the gallery, and this overrides all of your CSS code coming from <span class=\"code\">style.css<\/span> or anywhere else.<\/p>\n<div id=\"attachment_275\" style=\"width: 650px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/w3bits.com\/go\/dandelion\/\" rel=\"nofollow\"><img decoding=\"async\" aria-describedby=\"caption-attachment-275\" src=\"https:\/\/w3bits.com\/wp-content\/uploads\/2013\/01\/dandelion-wordpress-theme-gallery.jpg\" alt=\"Dandelion WordPress Theme Gallery\" class=\"size-full\" \/><\/a><p id=\"caption-attachment-275\" class=\"wp-caption-text\">Example of Custom Gallery on <a href=\"https:\/\/w3bits.com\/go\/dandelion\/\" rel=\"nofollow\" title=\"Gallery from Dandelion WordPress Theme\">Dandelion WordPress Theme<\/a><\/p><\/div>\n<p>So, the hurdle in our way to customize our gallery look is that automatically added <i>style<\/i> snippet. Once we restrict the addition of this default style, we are almost done.<\/p>\n<h3>How can I remove the default gallery style in WordPress?<\/h3>\n<p><b>So, what else I need to do to get this done?<\/b> Well, this can be accomplished by telling WordPress not to add that style code segment in the post containing a gallery. We can do that by adding the below hook in <span class=\"code\">functions.php<\/span> of our WordPress theme:<br \/>\n<code>add_filter( 'use_default_gallery_style', '__return_false' );<\/code><\/p>\n<p>Now, save the <span class=\"code\">functions.php<\/span> file and add your custom styles to <span class=\"code\">style.css<\/span> and test a gallery. Bang! Your custom WordPress gallery styles are now working!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We want to customize a lot of things in our WordPress themes, and WordPress gallery style can be one of those. At first, it looks like to throw some CSS code in the style.css and it&#8217;s done. But that alone, is not gonna work since WordPress automatically adds a default style snippet in the post [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":279,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-266","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Remove the default Gallery Style in WordPress<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Remove the default Gallery Style in WordPress\" \/>\n<meta property=\"og:description\" content=\"We want to customize a lot of things in our WordPress themes, and WordPress gallery style can be one of those. At first, it looks like to throw some CSS code in the style.css and it&#8217;s done. But that alone, is not gonna work since WordPress automatically adds a default style snippet in the post [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/\" \/>\n<meta property=\"og:site_name\" content=\"W3Bits\" \/>\n<meta property=\"article:published_time\" content=\"2013-01-21T13:21:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-05-11T17:35:59+00:00\" \/>\n<meta name=\"author\" content=\"Rahul\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@w3bits_\" \/>\n<meta name=\"twitter:site\" content=\"@w3bits_\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rahul\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/\",\"url\":\"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/\",\"name\":\"Remove the default Gallery Style in WordPress\",\"isPartOf\":{\"@id\":\"https:\/\/w3bits.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2013-01-21T13:21:45+00:00\",\"dateModified\":\"2015-05-11T17:35:59+00:00\",\"author\":{\"@id\":\"https:\/\/w3bits.com\/#\/schema\/person\/be0e5389728f04fca3db34bad77ef1ac\"},\"breadcrumb\":{\"@id\":\"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/w3bits.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Remove the default Gallery Style in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/w3bits.com\/#website\",\"url\":\"https:\/\/w3bits.com\/\",\"name\":\"W3Bits\",\"description\":\"Web Development Tutorials\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/w3bits.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/w3bits.com\/#\/schema\/person\/be0e5389728f04fca3db34bad77ef1ac\",\"name\":\"Rahul\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/w3bits.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e574a987fbce499dc42961a23e1dfd9bfddadff03a41086b4eea64154d266b29?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e574a987fbce499dc42961a23e1dfd9bfddadff03a41086b4eea64154d266b29?s=96&d=mm&r=g\",\"caption\":\"Rahul\"},\"description\":\"I'm Rahul, a web enthusiast and the person responsible for all the content you read here on W3Bits.\",\"url\":\"https:\/\/w3bits.com\/author\/meadminrahul9\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Remove the default Gallery Style in WordPress","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/","og_locale":"en_US","og_type":"article","og_title":"Remove the default Gallery Style in WordPress","og_description":"We want to customize a lot of things in our WordPress themes, and WordPress gallery style can be one of those. At first, it looks like to throw some CSS code in the style.css and it&#8217;s done. But that alone, is not gonna work since WordPress automatically adds a default style snippet in the post [&hellip;]","og_url":"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/","og_site_name":"W3Bits","article_published_time":"2013-01-21T13:21:45+00:00","article_modified_time":"2015-05-11T17:35:59+00:00","author":"Rahul","twitter_card":"summary_large_image","twitter_creator":"@w3bits_","twitter_site":"@w3bits_","twitter_misc":{"Written by":"Rahul","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/","url":"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/","name":"Remove the default Gallery Style in WordPress","isPartOf":{"@id":"https:\/\/w3bits.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/#primaryimage"},"image":{"@id":"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/#primaryimage"},"thumbnailUrl":"","datePublished":"2013-01-21T13:21:45+00:00","dateModified":"2015-05-11T17:35:59+00:00","author":{"@id":"https:\/\/w3bits.com\/#\/schema\/person\/be0e5389728f04fca3db34bad77ef1ac"},"breadcrumb":{"@id":"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/w3bits.com\/remove-wordpress-default-gallery-style\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/w3bits.com\/"},{"@type":"ListItem","position":2,"name":"Remove the default Gallery Style in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/w3bits.com\/#website","url":"https:\/\/w3bits.com\/","name":"W3Bits","description":"Web Development Tutorials","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/w3bits.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/w3bits.com\/#\/schema\/person\/be0e5389728f04fca3db34bad77ef1ac","name":"Rahul","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/w3bits.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e574a987fbce499dc42961a23e1dfd9bfddadff03a41086b4eea64154d266b29?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e574a987fbce499dc42961a23e1dfd9bfddadff03a41086b4eea64154d266b29?s=96&d=mm&r=g","caption":"Rahul"},"description":"I'm Rahul, a web enthusiast and the person responsible for all the content you read here on W3Bits.","url":"https:\/\/w3bits.com\/author\/meadminrahul9\/"}]}},"_links":{"self":[{"href":"https:\/\/w3bits.com\/wp-json\/wp\/v2\/posts\/266","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/w3bits.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/w3bits.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/w3bits.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/w3bits.com\/wp-json\/wp\/v2\/comments?post=266"}],"version-history":[{"count":2,"href":"https:\/\/w3bits.com\/wp-json\/wp\/v2\/posts\/266\/revisions"}],"predecessor-version":[{"id":2801,"href":"https:\/\/w3bits.com\/wp-json\/wp\/v2\/posts\/266\/revisions\/2801"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/w3bits.com\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/w3bits.com\/wp-json\/wp\/v2\/media?parent=266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/w3bits.com\/wp-json\/wp\/v2\/categories?post=266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/w3bits.com\/wp-json\/wp\/v2\/tags?post=266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}