Jen Calloway
asked 11 years ago

I’d like to have a section be displayed on the main page but not have it shown as a link in the main menu.

3 Answers
DominicStaff
answered 11 years ago

Hi Sientje,
To hide a page from the menu and leave the page visible when scrolling on the DW Page, please follow my instruction here:
Step1: open the framework.php file in the folder path “wp-content\themes\dw-page-modern\inc”
Step2: Find the line from 307 to 327 then replace the following code:

 foreach ($menu as $menu_item) {
            $active = $i == 0 ? 'class="active"' : '';
            $menu_id = sanitize_title($menu_item->title);
?>
            <li <?php echo $active ?>>
                <a href="#<?php echo $menu_id ?>">
            <?php echo $menu_item->title  ?>
                </a>
            </li>
<?php
            $i++;
        }
?>               
        </ul>
    </div>
<?php           
        }
    }
}

With the new code:

 foreach ($menu as $menu_item) {
            $active = $i == 0 ? 'class="active"' : '';
            $menu_id = sanitize_title($menu_item->title);

            if ($menu_item->menu_item_parent == 0) :
?>
            <li <?php echo $active ?>>
                <a href="#<?php echo $menu_id ?>">
            <?php echo $menu_item->title  ?>
                </a>
            </li>
<?php
            endif;
            $i++;
        }
?>               
        </ul>
    </div>
<?php           
        }
    }
}

See the screenshot:

Step3: Log in to Dashboard > Appearance > Menu then move the menu that you want to hide.
Example:  

  • Portfolio
        – Team

 
See the screenshot:
Hope this helps!

hellover
answered 11 years ago

Very useful solution Dominic!

I was more “dirty” and simple and directly make this from the css, just giving it a display: none from the style.css

For example:
.navbar .nav > li > a[href=”#home”]{display:none}

Regards!

DominicStaff
answered 11 years ago

Hello Hellover !
Thanks for your suggestion. I appreciate it.
Regards,

Powered by DW Question & Answer Pro