• Hello there!

    I am having trouble getting my main menu’s drop down menus to work on any ‘Post’ pages on my website (https://www.derekmunson.com).

    For example, if you’re on my “Gear” page (https://www.derekmunson.com/?page_id=34), the drop-downs under the “Lessons”, “Gigs”, and “Media” pages show up fine. However, if you’re reading a blog post (like this one: https://www.derekmunson.com/?p=619), the drop-downs aren’t available.

    This may be a simple question, but I’ve searched the WP Forums here for a solution to my particular problem and haven’t found the answer for my issue.

    Any help from anyone on this would be GREATLY appreciated. Thank you!

    – Derek

Viewing 15 replies - 1 through 15 (of 36 total)
  • On the Page on which the dropdowns work, the ul.children has the following inline style:

    <ul class="children" style="display: block; height: 0px; z-index: 63; overflow-x: hidden; overflow-y: hidden; opacity: 0.010416666666666666;">

    On the Page on which the dropdowns don’t work, the ul.children omits this inline style:

    <ul class="children">

    So, the question to figure out is: why (and how) is this inline style being added to the menu on one Page, and not on another?

    (Without access to your Theme template files, it’s not likely that we can answer that question.)

    …and note: I strongly suspect that this issue is related to your other thread, and is somehow a result of your having hacked up the index.php template file, which now no longer serves as a proper fallback for the other files in the template hierarchy.

    Thread Starter Drumology2001

    (@drumology2001)

    You may very well be right, Chip…let me take another run at the fix that you suggested and see if I can get it working. If so, I’ll take a look at this ul class issue and see if I can find anything out. I’ll report back here in a little bit. Thanks for your help! ??

    Thread Starter Drumology2001

    (@drumology2001)

    Okay, Chip: so I followed your instructions in the other thread again, and I left the site up so you can see what it’s doing. The page I created and assigned as the black Static Page (step 3) is called “New”.

    So here’s my questions:
    1) In the menu, the item “Home” is still there and I’m not sure how to get rid of it if “New” is going to be the new home page.
    2) In the “Recent News” box of the “New” page, it just says “New” and isn’t displaying my three latest posts like I want it to (and like it was doing before).

    The good news is that the “Blog” page works fine and displays the posts like I want it to, even when set to use the Default Template in the Page Attribute window. If I can get the Home page to work the way it did before, I’ll be very happy. Any ideas how I get rid of the default “Home” menu item, make “New” into “Home”, and get those posts back in the “Recent News” panel? I’m all ears, Chip. ??

    To help with specific questions like that, I’d really have to see the template files. How comfortable are you with using Pastebin? ??

    Thread Starter Drumology2001

    (@drumology2001)

    I’ve never used it, but I suppose I could do it – especially if it means getting my site all sorted out! Which files would you like me to paste there and link here?

    Let’s start with header.php, front-page.php, and functions.php

    Thread Starter Drumology2001

    (@drumology2001)

    Good morning, Chip! I reverted my site to working status in the meantime while you help me sort this stuff out; I’ve got some potential business partners looking at my site today, so I want it to be operational as possible while I’m not directly working on it. ??

    Here are the links to the PasteBin files:

    (header.php) https://pastebin.com/zziWtDak

    (front-page.php) https://pastebin.com/fiQqLCDQ

    (functions.php) https://pastebin.com/b43DSXBn

    So there’s the files. Thanks for having a look and seeing if there’s anything out of order. I will leave my website operational until I hear from you next. Thanks, Chip!

    Okay:

    1) The “Home” link in the header navigation menu

    Can you confirm what your Theme setting is, regarding what to use for the Navigation Menu? Is it set to use core Nav Menus (wp_nav_menu), or Pages?

    Depending on the Theme setting, the “Home” link is hard-coded. I suspect that you have the Theme set to use Pages.

    If so, then you’ll need to edit the template file, to remove this code, on line 61 (of the header.php Pastebin):

    <li class="<?php if (!is_paged() && is_home()) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php echo get_settings('home'); ?>/"><?php _e('HOME','piano-black'); ?></a></li>

    2) Front Page “Recent News” box:

    Because this is the front-page.php template file, the default Loop would pull in whatever you’ve entered into the content area for the “Front Page” static Page (which I assume you’ve left blank). This clearly isn’t what you want, so you’ll need to replace that output with a custom Loop.

    I would recommend using get_posts() (Codex ref), e.g.:

    $latestnews = get_posts( array(
         'numberposts' = 3
    ) );

    Which you can then use to replace your Loop code in front-page.php.

    Replace Line 29 with this:

    $latestnews = get_posts( array(
         'numberposts' = 3
    ) );
    foreach ( $latestnews as $news ) {
         setup_postdata( $news ); ?>

    Now, you’re inside your custom Loop.

    Leave all the code alone from lines 33 – 57. This is your Loop output, and you don’t want to change it.

    Replace line 61 with this:

    <?php } ?>

    This closes your foreach loop that you opened on line 29.

    You can safely get rid of the code from lines 61 – 81. Most important, though, is that you remove lines 73 and 81, because you no longer have the if ( have_posts() ) conditional to which these else: and endif calls apply.

    Let me know if you need any help, and I’ll be happy to update your Pastebin appropriately.

    Thread Starter Drumology2001

    (@drumology2001)

    CHIP! Your last post was AWESOME! That’s the kind of help I really appreciate from people.

    So, everything has gone pretty much according to plan, with one exception: I am getting a parse error regarding your last piece of code (the closing <?php } ?> statement). My browser says that the ‘}’ symbol is “unexpected”:

    Parse error: syntax error, unexpected '}' in (EDITEDOUT)/wp-content/themes/piano-black/front-page.php on line 61

    I’m not sure why this would happen; I see the statement’s opening curly bracket in the code you gave me, so…yeah.

    As an additional aside, this doesn’t seem to have fixed the navigation issue that this thread originally addressed, so once this parse error is ironed out, if you have any more ideas for what might be causing that, I am definitely open to them.

    Thanks again for all your help, Chip. Really great stuff. You clearly know your way around WordPress. ??

    Thread Starter Drumology2001

    (@drumology2001)

    Hello? Chip? Are you there? I still need your help!!! ??

    @drumology2001: can you post a pastebin of your as-modified file? I’ll see if I can track down the parse error.

    Thread Starter Drumology2001

    (@drumology2001)

    Sure thing! Here is the revised front-page.php file on Pastebin:
    https://pastebin.com/mu6m8ZnN

    Though the } bracket is showing on line 57 currently, I took it out for the time being because it crashes my entire site instead of just a part of the home page. I hope this is okay and doesn’t hinder your ability to troubleshoot – let me know if it does.

    Line 25 needs an opening PHP tag: <?php.

    This:

    $latestnews = get_posts( array(
         'numberposts' = 3
    ) );
    foreach ( $latestnews as $news ) {
         setup_postdata( $news ); ?>

    Should be this:

    <?php $latestnews = get_posts( array(
         'numberposts' = 3
    ) );
    foreach ( $latestnews as $news ) {
         setup_postdata( $news ); ?>

    Thread Starter Drumology2001

    (@drumology2001)

    Hmmm…okay, did that – now I get an entirely different error:
    Parse error: syntax error, unexpected ‘=’, expecting ‘)’ in /home/content/47/7343747/html/wp-content/themes/piano-black/front-page.php on line 26

    Pastebin has the updated file, same link as above:
    https://pastebin.com/mu6m8ZnN

Viewing 15 replies - 1 through 15 (of 36 total)
  • The topic ‘Drop-down menus not working on subpages?’ is closed to new replies.