• Resolved kathw

    (@kathw)


    Hi

    Total newbie here!

    I have created a child theme folder (twentyseventeen-child) in the themes folder.

    Inside the child theme folder, I have created a style.css file and a functions.php file.

    It looks like my style.css and functions.php file aren’t being called properly.
    What have I done wrong?

    
    functions.php file....
    add_action ("wp_enqueue_scripts", "theme_enqueue_styles");
    
    function theme_enqueue_styles() 
    {
         wp_enqueue_style ("parent-style", get_template_directory_uri() . "/style.css");
         wp_enqueue_style ("child-style", get_stylesheet_directory_uri() . "/style.css", array("parent-style"));
    }
    
    function hsl_breadcrumbs() 
    {   
    	...my code here (tested this function in main theme functions.php file and it works.
    }
    
    .style.css file....
    /*
    Theme Name:     	Twenty Seventeen Child Theme
     Author:         	KW
     Template:       	twentyseventeen
     Version:        	1.0.0
    */
    
    /* HSL Breacrumb Navigation  */
    .breadcrumb{
        width:645px;
        float:left;
        padding:0 0 0 47px;
        margin:9px 0 0 0;
        font-size:90%;
        clear:both;
    }
    
    .delimiter{
        color:#000;
        background-color:inherit;
    }
    
    .delimiter1{
        color: #627FC3;
        background-color:inherit;
    }
    
Viewing 15 replies - 1 through 15 (of 16 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you describe the issue you’re facing in more detail?

    Thread Starter kathw

    (@kathw)

    Hi

    I wrote a function called hsl_breadcrumbs.

    To display the results of this function, I installed a plugin called “PHP Code Widget”.

    In the widgets area, I added a new text widget to the Blog Sidebar and added in
    the code below:

    
    <?php 
        if (function_exists('hsl_breadcrumbs')) {hsl_breadcrumbs();} 
    ?>
    

    When I added the function hsl_breadcrumbs() to the functions.php file located in the “Twenty Seventeen” directory, the breacrumbs displayed.

    When I removed that function from the “Twenty Seventeen” functions.php file and added it in to the child theme, it stopped working.

    • This reply was modified 7 years, 2 months ago by kathw.
    • This reply was modified 7 years, 2 months ago by kathw.
    • This reply was modified 7 years, 2 months ago by kathw.
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    If you put an ‘echo’ in the functions.php file does it show in the source code?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Also basic question, have you activated the child theme in the dashboard?

    Thread Starter kathw

    (@kathw)

    Hi

    Yes, I did activate the theme!

    I commented out everything in the hsl_breadcrumb function in the child theme and
    then added in an echo line….

    and nothing showed up

    • This reply was modified 7 years, 2 months ago by kathw.
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What is the directory path of your Child Theme?

    And can you double-check the names of the files? They must be ‘style.css’ and ‘functions.php’.

    Also, do you have any caching?

    Thread Starter kathw

    (@kathw)

    Hi

    I am running this site locally at: https://localhost/mysite/

    My child theme is located in the themes folder and is called: twentyseventeen-child

    File names are:
    functions.php
    style.css

    No caching.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you copy all of the code from your (child theme) functions.php file and put it in a pastebin page pastebin.com ? And then link us to that

    Thread Starter kathw

    (@kathw)

    Hi

    ok did it -below is link

    https://pastebin.com/Jc19D2pA

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I’m not sure I understand, does your functions.php file contain all of this code: https://pastebin.com/Jc19D2pA ? Or is that a split between style.css and functions.php

    Thread Starter kathw

    (@kathw)

    Hi

    That is split between functions.php and style.css

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Would you be able to recreate the pastebin page with just functions.php?

    Thread Starter kathw

    (@kathw)

    Hi

    https://pastebin.com/a8t6225f

    Thank you so much for helping me

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    No worries, we’re all helping out of our spare time so we may disappear from time to time, but we always come back to help if we can.

    I see you have this:

    
    function hsl_breadcrumbs()
    {  
        echo "IN HERE 1";
    }
    

    Can you try echoing outside of the function? Just to make sure your functions.php file is running at all.
    Like this:

    
    echo "IN OUTSIDE HERE";
    
    function hsl_breadcrumbs()
    {  
        echo "IN HERE 1";
    }
    
    Thread Starter kathw

    (@kathw)

    Hi

    I just de-activated the child them and then re-activated the child theme and it’s working now.

    Thank you so much for your time and I’m sorry I should have tried that earlier.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Twenty Seventeen Child Theme Issue’ is closed to new replies.