I’m developing 3 custom CSS styles in my Child theme with LayersWP but can’t find this link of code in the header.php file

Asked on February 22, 2016 in Customization.

I’m developing 3 custom CSS styles in my Child theme with LayersWP but can’t find this link of code in the header.php file -> <link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); ?>” type=”text/css” media=”screen” /> as I need to replace it with this ->

<?php

global $options;

foreach ($options as $value) {

if (get_settings( $value[‘id’] ) === FALSE) { $$value[‘id’] = $value[‘std’]; } else { $$value[‘id’] = get_settings( $value[‘id’] ); }

}

?>

<?php switch ($mst_style_sheet) {

case “default”:?>

<link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); ?>” type=”text/css” media=”screen” />

<?php break; ?>

<?php case “green”:?>

<link rel=”stylesheet” href=”<?php bloginfo(‘template_directory’); ?>/green.css” type=”text/css” media=”screen” />

<?php break; ?>

<?php case “blue”:?>

<link rel=”stylesheet” href=”<?php bloginfo(‘template_directory’); ?>/blue.css” type=”text/css” media=”screen” />

<?php break; ?>

<?php }?>

Any help will be much appreciated.

Grant Layers User
Reply
  • Possible Answers to Your Question:

  • 1 Answer(s)
    Answered on March 7, 2016.

    Hi there,
    You cannot replace or remove the basic call to the layers stylesheet. If you are trying to implement style switching, you need to add a cusotm control that allows the user to select the stylesheet, then add enqueues for each stylesheet that are in a condition based on whether they are selected or not (via get_option  or layers_get_themje_mod). The code example above also contains deprecated WordPress tags and needs to be updated so please check your source or ensure bloginfo is replaced with the correct path function.

    https://docs.layerswp.com/theming/#styling-fonts

    https://docs.layerswp.com/theming/#including-scripts-php-files
    https://docs.layerswp.com/theming/#customizer-controls-defaults

    Reply