Browse Source

Reduplicate some code to make sre things work without Pressbooks.

pull/81/head
Ned Zimmerman 7 years ago
parent
commit
7b0b88a45c
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 29
      inc/actions/namespace.php

29
inc/actions/namespace.php

@ -170,6 +170,35 @@ function content_width() {
function output_custom_colors() { function output_custom_colors() {
if ( defined( 'PB_PLUGIN_VERSION' ) ) { if ( defined( 'PB_PLUGIN_VERSION' ) ) {
echo \Pressbooks\Admin\Branding\get_customizer_colors(); echo \Pressbooks\Admin\Branding\get_customizer_colors();
} else {
$colors = [
'primary',
'accent',
'primary_fg',
'accent_fg',
'primary_dark',
'accent_dark',
'primary_alpha',
'accent_alpha',
'header_text',
];
$values = [];
foreach ( $colors as $k ) {
$v = get_option( "pb_network_color_$k" );
if ( $v ) {
$values[ $k ] = $v;
}
}
$output = '';
if ( ! empty( $values ) ) {
$output .= '<style type="text/css">:root{';
foreach ( $values as $k => $v ) {
$k = str_replace( '_', '-', $k );
$output .= "--$k:$v;";
}
$output .= '}</style>';
}
echo $output;
} }
} }

Loading…
Cancel
Save