Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #49522
    John U
    Member

    Hello – I love the way the #masthead is sticky and stays at the top when scrolling down. Is there any way to do this with the #secondary-menu?

    I have tried some plugins – Sticky Menu and MyStickyMenu but they both have problems with Chrome vs FireFox and different size browswers which #masthead doesn’t have.

    It looks like #secondary-menu is inside the #main-wrapper. Do I have to move it into the masthead or create a new widget?

    Here’s the site: chezjillchocolates.com

    #49526
    Sakin
    Keymaster

    @John U: To move the secondary menu position, first you need to build child theme, For child theme ready this http://catchthemes.com/blog/create-child-theme-wordpress/ and then you need to add the following code in your child theme functions.php file:

    // Removing the Default Action Hook
    function unhook_adventurous_functions() {
    	//remove default secondary menu
    	add_action( 'adventurous_before_main', 'adventurous_secondary_menu', 10 );
    }
    add_action( 'init', 'unhook_adventurous_functions' );
    
    // Add Secondary menu after hgroup wrpa
    add_action( 'adventurous_after_hgroup_wrap', 'adventurous_secondary_menu', 5 );
    #49568
    John U
    Member

    I made the Child Theme – but the changes don’t work.

    Here is my child theme’s functions.php file:

    <?php
    // Removing the Default Action Hook
    function unhook_adventurous_functions() {
    	//remove default secondary menu
    	add_action( 'adventurous_before_main', 'adventurous_secondary_menu', 10 );
    }
    add_action( 'init', 'unhook_adventurous_functions' );
    
    // Add Secondary menu after hgroup wrpa
    add_action( 'adventurous_after_hgroup_wrap', 'adventurous_secondary_menu', 5 );

    I believe both the parent and child theme’s functions.php files are called – if so, how could the child theme overwrite the parent?

    I tried adding CSS to fix the 2nd Nav Bar but no luck.

    Source Code still shows the 2nd Nav Bar inside the Main Wrapper.

    Any suggestions?

    I also tried this for child theme’s functions.php

    <?php
    
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
    
    // BEGIN ENQUEUE PARENT ACTION
    
    if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
        function chld_thm_cfg_parent_css() {
            wp_enqueue_style( 'chld_thm_cfg_parent', get_template_directory_uri() . '/style.css' ); 
        }
    endif;
    add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
    
    // END ENQUEUE PARENT ACTION
    
    // Removing the Default Action Hook
    function unhook_adventurous_functions() {
    	//remove default secondary menu
    	add_action( 'adventurous_before_main', 'adventurous_secondary_menu', 10 );
    }
    add_action( 'init', 'unhook_adventurous_functions' );
    
    // Add Secondary menu after hgroup wrpa
    add_action( 'adventurous_after_hgroup_wrap', 'adventurous_secondary_menu', 5 );
    

    but no luck.

    #49591
    Sakin
    Keymaster

    @John U: Sorry I gave to wrong code. I forgot to remove the actions. So the code will be as below:

    // Removing the Default Action Hook
    function unhook_adventurous_functions() {
    	//remove default secondary menu
    	remove_action( 'adventurous_before_main', 'adventurous_secondary_menu', 10 );
    }
    add_action( 'init', 'unhook_adventurous_functions' );
    
    // Add Secondary menu after hgroup wrpa
    add_action( 'adventurous_after_hgroup_wrap', 'adventurous_secondary_menu', 5 );
    #49760
    John U
    Member

    nope – not working – screen goes white on Live Preview – any suggestions?

    Have you actually tested this code on your end?

    #49761
    John U
    Member

    What is the proper code to enqueue the CSS style page? This theme has a CSS folder with other styles in it.

    Here is my functions.php file including the code for the Sticky 2nd Nav Menu

    <?php
    /**
     * Adventurous Pro Child Theme functions and definitions
     */
     /**
     * Enqueue the parent theme style.css because @import doesn't work in ie8
     */
     
    function adventurous-pro_enqueue_scripts_styles() {
    	wp_enqueue_style( 'parent-theme-css', get_template_directory_uri() . '/style.css' );
    }
    
    add_action( 'wp_enqueue_scripts', 'adventurous-pro_enqueue_scripts_styles' );
    
    // Removing the Default Action Hook
    function unhook_adventurous_functions() {
    	//remove default secondary menu
    	add_action( 'adventurous_before_main', 'adventurous_secondary_menu', 10 );
    }
    add_action( 'init', 'unhook_adventurous_functions' );
    
    // Add Secondary menu after hgroup wrpa
    add_action( 'adventurous_after_hgroup_wrap', 'adventurous_secondary_menu', 5 );

    Questions: How to enqueue the other styles is the CSS folder?

    #49771
    Sakin
    Keymaster

    @John U: Other CSS are automatically added and the parent style.css is imported in style.css of child theme. You will see the following CSS in your child theme style.css

    /* =Import Adventurous Pro CSS
    -------------------------------------------------------------- */
    
    @import url("../adventurous-pro/style.css");

    So, you don’t need to add adventurous-pro_enqueue_scripts_styles() function in your child theme functions.php file. Also in your //remove default secondary menu, you have done add_action and it should be as remove_action. Your child theme functions.php file should be as.

    #49815
    Sakin
    Keymaster

    @John U: Either you need to remove import from your child theme style.css or remove wp_enqueue_style() from your child theme functions.php file. It’s not good to keep it both.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Sticky 2nd Nav Menu’ is closed to new replies.