{"id":2521,"date":"2018-04-18T19:37:52","date_gmt":"2018-04-19T02:37:52","guid":{"rendered":"https:\/\/www.elegantthemes.com\/documentation\/?p=2521"},"modified":"2018-04-18T19:37:52","modified_gmt":"2018-04-19T02:37:52","slug":"defining-custom-css-fields-for-modules","status":"publish","type":"post","link":"https:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/","title":{"rendered":"Defining Custom CSS Fields For Modules"},"content":{"rendered":"<blockquote><p><strong>Note:<\/strong> This tutorial series is intended for advanced users. At least a basic understanding of coding in PHP and JavaScript is required.<\/p><\/blockquote>\n<p>Custom CSS fields appear in the <em>Advanced<\/em> tab of the module settings modal and allow users to set custom CSS properties for predefined target elements within the module\u2019s HTML output. The fields are automatically generated based on the configuration defined in the module\u2019s <code>get_custom_css_fields_config()<\/code> method.<\/p>\n<h2 id=\"custom-css-fields-configuration\">Custom CSS Fields Configuration<\/h2>\n<ul>\n<li><strong>element_one<\/strong> <em>(array)<\/em>\n<ul>\n<li><strong>label<\/strong> <em>(string)<\/em> \u2014 Display name for the target element (localized)<\/li>\n<li><strong>selector<\/strong> <em>(string)<\/em> \u2014 CSS selector for the target element<\/li>\n<li><strong>no_space_before_selector<\/strong> <em>(bool)<\/em> \u2014 Don\u2019t put a space before selector<\/li>\n<\/ul>\n<\/li>\n<li><strong>element_two<\/strong> <em>(array)<\/em>\n<ul>\n<li><strong>label<\/strong> <em>(string)<\/em> \u2014 Display name for the target element (localized)<\/li>\n<li><strong>selector<\/strong> <em>(string)<\/em> \u2014 CSS selector for the target element<\/li>\n<li><strong>no_space_before_selector<\/strong> <em>(bool)<\/em> \u2014 Don\u2019t put a space before selector<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2 id=\"custom-css-fields-configuration-example\">Custom CSS Fields Configuration Example<\/h2>\n<div><script src=\"https:\/\/gist.github.com\/lots0logs\/40fccd15d6e3e7b5be4638dabe56d8b0.js?ts=4\"><\/script><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to define custom CSS fields for modules.<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,23],"tags":[],"class_list":["post-2521","post","type-post","status-publish","format-standard","hentry","category-developers","category-divi-module"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Elegant Themes Documentation<\/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:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Defining Custom CSS Fields For Modules - Elegant Themes Documentation\" \/>\n<meta property=\"og:description\" content=\"Learn how to define custom CSS fields for modules.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/\" \/>\n<meta property=\"og:site_name\" content=\"Elegant Themes Documentation\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-19T02:37:52+00:00\" \/>\n<meta name=\"author\" content=\"Dustin Falgout\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dustin Falgout\" \/>\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\":\"Article\",\"@id\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/developers\\\/divi-module\\\/defining-custom-css-fields-for-modules\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/developers\\\/divi-module\\\/defining-custom-css-fields-for-modules\\\/\"},\"author\":{\"name\":\"Dustin Falgout\",\"@id\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/#\\\/schema\\\/person\\\/0e2387f96b40940c4d33e54bac52e79b\"},\"headline\":\"Defining Custom CSS Fields For Modules\",\"datePublished\":\"2018-04-19T02:37:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/developers\\\/divi-module\\\/defining-custom-css-fields-for-modules\\\/\"},\"wordCount\":147,\"articleSection\":[\"Developer Documentation\",\"Divi Module: In-Depth\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/developers\\\/divi-module\\\/defining-custom-css-fields-for-modules\\\/\",\"url\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/developers\\\/divi-module\\\/defining-custom-css-fields-for-modules\\\/\",\"name\":\"Defining Custom CSS Fields For Modules - Elegant Themes Documentation\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/#website\"},\"datePublished\":\"2018-04-19T02:37:52+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/#\\\/schema\\\/person\\\/0e2387f96b40940c4d33e54bac52e79b\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/developers\\\/divi-module\\\/defining-custom-css-fields-for-modules\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/developers\\\/divi-module\\\/defining-custom-css-fields-for-modules\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/developers\\\/divi-module\\\/defining-custom-css-fields-for-modules\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Defining Custom CSS Fields For Modules\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/#website\",\"url\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/\",\"name\":\"Elegant Themes Documentation\",\"description\":\"Just another WordPress site\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.elegantthemes.com\\\/documentation\\\/#\\\/schema\\\/person\\\/0e2387f96b40940c4d33e54bac52e79b\",\"name\":\"Dustin Falgout\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4e8ced4a3ccff2b6839ae64b6e01266bb3da7dcbd5d0d391a1886029e7feac13?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4e8ced4a3ccff2b6839ae64b6e01266bb3da7dcbd5d0d391a1886029e7feac13?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4e8ced4a3ccff2b6839ae64b6e01266bb3da7dcbd5d0d391a1886029e7feac13?s=96&d=mm&r=g\",\"caption\":\"Dustin Falgout\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Elegant Themes Documentation","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:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/","og_locale":"en_US","og_type":"article","og_title":"Defining Custom CSS Fields For Modules - Elegant Themes Documentation","og_description":"Learn how to define custom CSS fields for modules.","og_url":"https:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/","og_site_name":"Elegant Themes Documentation","article_published_time":"2018-04-19T02:37:52+00:00","author":"Dustin Falgout","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Dustin Falgout","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/#article","isPartOf":{"@id":"https:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/"},"author":{"name":"Dustin Falgout","@id":"https:\/\/www.elegantthemes.com\/documentation\/#\/schema\/person\/0e2387f96b40940c4d33e54bac52e79b"},"headline":"Defining Custom CSS Fields For Modules","datePublished":"2018-04-19T02:37:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/"},"wordCount":147,"articleSection":["Developer Documentation","Divi Module: In-Depth"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/","url":"https:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/","name":"Defining Custom CSS Fields For Modules - Elegant Themes Documentation","isPartOf":{"@id":"https:\/\/www.elegantthemes.com\/documentation\/#website"},"datePublished":"2018-04-19T02:37:52+00:00","author":{"@id":"https:\/\/www.elegantthemes.com\/documentation\/#\/schema\/person\/0e2387f96b40940c4d33e54bac52e79b"},"breadcrumb":{"@id":"https:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.elegantthemes.com\/documentation\/developers\/divi-module\/defining-custom-css-fields-for-modules\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.elegantthemes.com\/documentation\/"},{"@type":"ListItem","position":2,"name":"Defining Custom CSS Fields For Modules"}]},{"@type":"WebSite","@id":"https:\/\/www.elegantthemes.com\/documentation\/#website","url":"https:\/\/www.elegantthemes.com\/documentation\/","name":"Elegant Themes Documentation","description":"Just another WordPress site","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.elegantthemes.com\/documentation\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.elegantthemes.com\/documentation\/#\/schema\/person\/0e2387f96b40940c4d33e54bac52e79b","name":"Dustin Falgout","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4e8ced4a3ccff2b6839ae64b6e01266bb3da7dcbd5d0d391a1886029e7feac13?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4e8ced4a3ccff2b6839ae64b6e01266bb3da7dcbd5d0d391a1886029e7feac13?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4e8ced4a3ccff2b6839ae64b6e01266bb3da7dcbd5d0d391a1886029e7feac13?s=96&d=mm&r=g","caption":"Dustin Falgout"}}]}},"_links":{"self":[{"href":"https:\/\/www.elegantthemes.com\/documentation\/wp-json\/wp\/v2\/posts\/2521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elegantthemes.com\/documentation\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elegantthemes.com\/documentation\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elegantthemes.com\/documentation\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elegantthemes.com\/documentation\/wp-json\/wp\/v2\/comments?post=2521"}],"version-history":[{"count":2,"href":"https:\/\/www.elegantthemes.com\/documentation\/wp-json\/wp\/v2\/posts\/2521\/revisions"}],"predecessor-version":[{"id":2523,"href":"https:\/\/www.elegantthemes.com\/documentation\/wp-json\/wp\/v2\/posts\/2521\/revisions\/2523"}],"wp:attachment":[{"href":"https:\/\/www.elegantthemes.com\/documentation\/wp-json\/wp\/v2\/media?parent=2521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elegantthemes.com\/documentation\/wp-json\/wp\/v2\/categories?post=2521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elegantthemes.com\/documentation\/wp-json\/wp\/v2\/tags?post=2521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}