• Hello,
    My site https://www.lucyryderwebprint.co.uk/test
    is using a child theme of twentyeleven.

    I have 1 custom menu for the navigation, set as the Primary menu. I have 5 child links under ‘My Work’ , and want them to only be visible on a 2nd row of navigation, when their parent ‘My work’ is clicked.

    In the custom menu settings, the child links are sat under ‘My work’, indented to the right to show they are it’s children.

    Currently the child links break the main parent links in the second line of links.

    Are there any WordPress Gurus out there who might know how to achieve this?…

    Many thanks in advance!!
    ??

Viewing 3 replies - 16 through 18 (of 18 total)
  • Hi Lucy,

    Your styles and scripts should be loading from the same parent directory, but for some reason they are not: style.css is being loaded from wp-content/themes/twentyeleven-child/style.css, and menu.js is being loaded from wp-content/themes/twentyeleven/menu.js.
    That is probably the reason for the discrepancies you seem to be experiencing between your live and local tests.
    Since you are developing a child theme, you should put your JS folder inside the twentyeleven-child folder. In that case, and assuming your menu.js is located inside wp-content/themes/twentyeleven-child/js/, this slightly different call should force WP to look for the menu.js file in the child theme folder instead of the original Twenty Eleven one:

    <script src="<?php echo get_bloginfo('stylesheet_directory');?>/js/menu.js" type="text/javascript"></script>

    As for my profile, I’m not a moderator: just a regular user who likes to help out on the forums whenever I have time, ??

    Let me know if you have any other questions.
    Cheers!

    Edit: Oh, I almost forgot. You seem to be calling jQuery twice on your test site, and different versions as well:
    – On line 15, v.1.4.2 from the Google Ajax API engine:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>

    – On line 34, v.1.6.1. from WP includes folder:

    <script type='text/javascript' src='https://www.lucyryderwebprint.co.uk/test/wp-includes/js/jquery/jquery.js?ver=1.6.1'></script>

    You should only keep one of these. My advise would be to always use the most recent version of jQuery. If you want to load it from Google because of speed, you should first unregister WP’s version and register Google’s. You can do that from your functions.php file with the following code:

    function user_custom_jquery() {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js'), false, false, true;
        wp_enqueue_script( 'jquery' );
    }
    add_action('wp_enqueue_scripts', 'user_custom_jquery');

    The true part is the value for the in_footer parameter. Change it to false to load it from your header instead of your footer.

    Thread Starter LucyRyder

    (@lucyryder)

    Hi Marventus, ah that makes sense, i knew it must be a slight change in how the call fins the path to the .js file – i’ll try this tomorrow!

    And yes I was just trying out liking to the online JQuery library to see if it fixed any of my conflicting plugin issues, but thanks for pointing out that WordPress houses its own version anyway at that location I did not know this!

    Well if you are doing this out of passion for developing and helping other people then i think that is very very kind of you.

    Many thanks!
    Lucy

    Hi Lucy,

    I’m doing a follow up on the topics in which I contributed. Were you ever able to figure this out?
    Do let me know if you encounter any problems.

    Cheers!

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Custom menus – hiding child links until parent is clicked’ is closed to new replies.