• Hi I created my custom templates with dreamweaver and I use child themes. My problem is that I want my custom template to use plugins but not current theme css. When i put wp_head() in the head section and wp_footer() in the footer my current theme is overriding my custom template CSS file.

    How do I prevent my current theme from overriding my custom template css?

    Also how do use plugins in my custom theme?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    How are you loading your custom template css file?

    Thread Starter devengeorg

    (@devengeorg)

    I uploaded css files on the child theme so i can load it there.

    I load stylesheet in the head

    <head>
    
    <code><link rel="stylesheet" href="https://www.****.com/wp-content/themes/sparkling-child/css/bootstrap-theme.min.css"/></code>
        <code><link rel="stylesheet" href="https://www.****.com/wp-content/themes/sparkling-child/css/bootstrap.css"/></code>

    <link rel=”stylesheet” href=”https://www.****.com/wp-content/themes/sparkling-child/css/style.css”&gt;
    <?php wp_head()?>
    </head>

    without wp_head() the custom template is working fine but with it, it breaks the theme design.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    So out of those files, ‘bootstrap-theme.min.css’, ‘bootstrap.css’ and ‘style.css’, which is the one that you said is being overridden?

    Thread Starter devengeorg

    (@devengeorg)

    style.css
    bootstrap.css

    The problem is that the main theme css will show in the html code

    so there will be two style.css in the head my custom template.

    How do I remove the main theme css files if I use wp_head() in the head section of my custom template?

    Thanks

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What’s in your child theme functions.php file? You should be able to remove a line of code there

    Thread Starter devengeorg

    (@devengeorg)

    Ok I found the code here `if ( !function_exists( ‘chld_thm_cfg_parent_css’ ) ):
    function chld_thm_cfg_parent_css() {
    wp_enqueue_style( ‘chld_thm_cfg_parent’, trailingslashit( get_template_directory_uri() ) . ‘style.css’ );
    }
    endif;
    add_action( ‘wp_enqueue_scripts’, ‘chld_thm_cfg_parent_css’ );`

    I use child theme configurator.

    I am really new with WordPress. I know I can remove that but my default theme would not work properly.

    How am I going to detect if it’s using default template or custom template so that I can enqueue the main theme css or not.

    Thanks

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I am surprised that your parent theme style.css file appears when you’re not using wp_head, because that stylesheet should have been enqueued. Maybe you have to go back into your parent theme and enqueue your (parent theme) style.css properly.

    Then when you don’t use the wp_head function in your Child Theme, it shouldn’t load the parent theme’s style.css file.

    Thread Starter devengeorg

    (@devengeorg)

    Maybe it’s a theme error ok i’ll try to dig in.

    Thanks you

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘CUSTOM TEMPLATES HOW TO USE PLUGINS’ is closed to new replies.