Child Theme Primary Nav

  • Author
    Posts
  • #66140
    marknhewitt
    Power User

    Using a child theme breaks the primary navigation. all the primary links appear but not the secondary links (drop downs) if I switch the site to the main theme the primary nav menu works as it should.

    Website: freelancegeek.marknhewitt.co.uk

    • This topic was modified 3 years ago by marknhewitt. Reason: wrong website
    #66141
    marknhewitt
    Power User

    Child style.css

    /*
    Theme Name: Septera Child Theme
    Template: septera
    Version: 1.0.3.1
    */
    

    Child functions.php

    <?php 
    function my_theme_enqueue_styles() {
    
        $parent_style = 'parent-style';
    
        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 )
        );
    }
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    

    Just in case you ask 🙂

    #66145
    marknhewitt
    Power User

    I think it may be to do with the website being in a subdomain, seems to work fine is on a normal domain 🙁

    If I download to version 1.2.4 the menu works fine again

    • This reply was modified 3 years ago by marknhewitt. Reason: additional info
    #66449
    Zed
    Cryout Creations mastermind

    Septera needs its styles to load in a certain order.

    Try the code below for the child theme enqueues:

    function septera_child_styling(){
    	wp_enqueue_style( 'septera-main', get_template_directory_uri() . '/style.css', array(), _CRYOUT_THEME_VERSION );  // restore correct parent stylesheet
    	wp_enqueue_style( 'septera-child', get_stylesheet_directory_uri() . '/style.css', array( 'septera-main' ), '0.1' ); 		// enqueue child stylesheet	
    }
    add_action( 'wp_enqueue_scripts', 'septera_child_styling' );

    Try not to change the style ids as they are used for other enqueues as well.


    If you like our creations, help us share by rating them on WordPress.org.
    Please read the available documentation and search the forums before posting.
Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Child Theme Primary Nav’ is closed to new replies.