Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter NabeelahS

    (@nabeelahs)

    I’ve recently updated my theme and I’ve noticed some (not all) of my styling added to my child theme is being overridden. Before the update I didnt need to enque my parent or child stylesheet. Does this overriding mean that I have to enque my parent or child stylesheet? And if so would I need to enque both or just the child?

    Thread Starter NabeelahS

    (@nabeelahs)

    @joyously

    Thank you so much. I didn’t need to enque either parent or child stylesheet. Thanks again. Appreciate it.

    Thread Starter NabeelahS

    (@nabeelahs)

    @joyously

    Sorry for all this back and forth.

    Just to confirm if the parent stylesheet uses get_template_directory() then I SHOULD or SHOUDN’T need to enque the parent stylesheet.

    If I do have to enque the parent stylesheet, do I have to enque both the parent and the child stylesheet OR just the parent?

    Thread Starter NabeelahS

    (@nabeelahs)

    @joyously

    I have looked in the code and looks like my theme uses get_template_directory so I
    can just use ‘style’ as ‘parent-style’ because that’s the name of my parent’s stylesheet?

    • This reply was modified 6 years, 5 months ago by NabeelahS.
    Thread Starter NabeelahS

    (@nabeelahs)

    @joyously

    Okay I understand why it worked as expected without the enqueing. This is because I am using the @import for my parent, in my child stylesheet. So now to remove the @import and use the following as suggested by @raduconstantin and the documentation.

    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    function my_theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    }

    Can someone tell me what ‘parent-style’ is meant to be replaced with? Is that the name of the parent stylesheet? For me since my parent stylesheet is ‘style.css’, it would be ‘style’. Is that correct?

    Thread Starter NabeelahS

    (@nabeelahs)

    Thanks for the help.

    @joyously does that mean that I don’t have to enque my stylesheet? It seemed my parent already was in effect and the when I added a child themed with my child theme css, that took effect after.

    How do you know whether you need to enque your parent and or child stylesheet?

    Thread Starter NabeelahS

    (@nabeelahs)

    @sjaure sorry I didn’t realise I marked this as resolved. I’m just trying to understand the enquing if the stylesheet a bit better. See questions in previous comment.

    Thanks

    Thread Starter NabeelahS

    (@nabeelahs)

    Okay. Thanks. I have managed to get the javascript file to enque which works now.

    But still having trouble with enquing the style. So from what I understand you need to enque the style from the parent theme and then enque the style from the child theme, is that right?

    – now the style for my parent is ‘style.css’ and my child theme is called ‘style.css’ as well.

    So in addition to my javascript enque on my functions.php in my child theme I would have the following:

    function my_theme_enqueue_styles() {

    $parent_style = ‘style.css’;

    wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘style.css’,
    get_stylesheet_directory_uri() . ‘/style.css’,
    array( $parent_style ),
    wp_get_theme()->get(‘2.0.0’)
    );
    }
    add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’);

    Where the version is the version of the child theme?

    Thread Starter NabeelahS

    (@nabeelahs)

    @sjaure

    Thanks so much for your help. I was having trouble with the path of the javascript file but managed to figure it out after looking into some other people’s solutions elsewhere.

    Thanks again, appreciate the help.

    Thread Starter NabeelahS

    (@nabeelahs)

    @sjaure thanks, I have had a look at the link you provided. Can you explain what the ‘parent-style’ is? Is that the name of the css file for the parent? Wouldn’t it be ‘style’?

    Also what is ‘Version’? Is that the version of the parent theme or child theme?

    Both ‘my-child-script.js’ and functions.php file sit in my child theme and the javascript file is not under a folder called ‘js’. So would the path just be ‘/my-child-script.js’?

    Thread Starter NabeelahS

    (@nabeelahs)

    @sjaure

    Thanks for that. Do you add the enque code into the functions.php file in the child script?

    Also I have looked at that documentation but I find it a bit hard to follow. If my javascript file is called ‘my-child-script.js’ how would I go about writing the enque script for the functions.pho file in the child theme?

    Also currently my style.css file in the child theme is not enqued but appears to apply the styling as expected. Do I need to enque the style.css file as well? And how would I do this?

    Thanks again

    • This reply was modified 6 years, 6 months ago by NabeelahS.
    Thread Starter NabeelahS

    (@nabeelahs)

    Thanks Steve. But how do I get to phpmyadmin. Is that within WordPress somehere else?

    Thread Starter NabeelahS

    (@nabeelahs)

    Hello, thanks for the reply and sorry for my late one.

    It’s for my own WordPress website. I managed to change my user profile email address but I want to change the admin email address. I know where to go to do so but I never receive a confirmation email. I have checked my spam as well. Any ideas??

Viewing 13 replies - 1 through 13 (of 13 total)