Site logo

Archived topic

An alternative way to add custom css and backup/export/save it for another site

3 replies · Started by Pete on December 25, 2014

Viewing posts 1–4 of 4

Install this plugin: https://wordpress.org/plugins/code-snippets/

Add a new snippet like this... (i've added my css as an example only)
Add your css between the echo '<style type="text/css"> and </style>'; tags

// EXTRA Theme CSS
function custom_css() {
   echo '<style type="text/css">
.textwidget.widget-text form select#cat.postform {margin-bottom:5px;}

.entry-meta {display:none;}
.entry-meta {color:#333;}

.sidebar form select#cat.postform {font-size:14px;padding:5px;}

.entry-content ul {margin:20px;}
.entry-content ul li {list-style-type:disc;}
.entry-content ul ul {margin:0px 0px 0px 20px ;}
.entry-content ul li ul li {list-style-type:circle;}
.entry-content ul ul ul {margin:0px 0px 0px 20px ;}
.entry-content ul li ul li ul li {list-style-type:square;}
.entry-content ul ul ul ul {margin:0px 0px 0px 20px ;}
.entry-content ul li ul li ul li ul li {list-style-type:lower-roman ;}
.entry-content ul ul ul ul ul {margin:0px 0px 0px 20px ;}
.entry-content ul li ul li ul li ul li ul li{list-style-type:lower-alpha ;}

.entry-content ul li.cat-item a {font-weight:400;}
.entry-content ul li ul li.cat-item a {font-weight:400;}

.widget ul {margin-left: 20px;}
.widget ul li {list-style-type: disc;}

.sidebar-font-size {font-size:87%;}

.uwpqsf_class label {margin-left:10px;}
.uwpqsf_class label input {margin-right:5px;}

.widgets_on_page ul {margin-left:0px;}
.widgets_on_page ul li {list-style-type:none; margin-left:0px;font-family: Open Sans;}
.widgets_on_page ul li {padding:0px;}
.widgets_on_page ul li ul {margin-left:0px;list-style-type:none;}
.widgets_on_page ul li ul li {margin-left:0px;list-style-type:none;}
.widgets_on_page ul li ul li ul li {margin-left:20px;list-style-type:none;}
.widgets_on_page ul li ul li ul li ul li {list-style-type:none;}
.widgets_on_page h4 {font-weight:700;margin:20px 0px 5px 0px ;border-top:dotted 1px #ccc;}
.entry-content #browse.widgets_on_page ul li.widget.widget_taxonomy-drill-down {padding:0px;}

#post-727 .entry-content {margin-top:0px;}
         </style>';
}

add_action('wp_head', 'custom_css');

You can then export this code and css to an xml export file that you can import to another GP site :)

Or I suppose you could just use Tom's method in his signature and save it in a text file.

Thanks for the alternative way - this would definitely work.

Personally, I would prefer to use a child theme style.css or a plugin like my signature and save it in a text file, but the PHP method would work as well :)

Thanks for sharing!

Me too ☺

This archived topic is closed to new replies.