• Hi,

    I have spent the last four hours trying various methods from the forums to do this and none have worked.

    The web page is boomerbalancebikes/facebook-offer and I want to remove the top menu as this is a landing page. Just cannot get it to work. The template was TwentyTwelve.

    I’ve tried all sorts of CSS in the stylesheet and nothing works. Any ideas? At my wits end! Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • you should post the full url to your site. The boomerbalancebikes/facebook-offer isn’t a url.

    Doesn’t seem like your site enables us to see the page ID via developer console inspection.

    Can you go to the WYSIWYG backend editor of the page and copy/paste the URL you see?

    It’ll look something like this: boomerbalancebikes.co.uk/wp-admin/post.php?post=13377&action=edit

    The “post=13377” denotes the page ID.

    I’m able to remove the menu via my browser, but I’ll need the ID (put in bold in above URL), to target the sales offer page and see if I can help you reproduce the same result.

    Thread Starter johnd1984

    (@johnd1984)

    Hi Nichlas,

    Thanks for getting back to me!

    http://boomerbalancebikes.co.uk/wp-admin/post.php?post=1385&action=edit

    Does that help?

    Hey johnd1984
    Just add this line in the themes file called functions.php file an you work will be done

    function harimay_wp_footer_callback() {
    	if( is_page( 1385 ) ){ ?>
    		<style type="text/css">
    			body nav#site-navigation{
    				display: none!important;
    			}
    		</style><?php
    	}
    }
    add_action( 'wp_footer', 'harimay_wp_footer_callback' );

    The url is for the admin page I’m assuming your referring to this page.
    http://boomerbalancebikes.co.uk/facebook-offer/.

    Since your only wanting to do this for a single page and not the entire site you would probably want to create a template for your theme. You would want to create a child theme and add the template into it.

    Here the instructions for creating a child theme. https://codex.wordpress.org/Child_Themes. You just need to create a folder with the name you want to call your new child theme and add 2 files. Your style.css and the functions.php file. You can copy the code from the codex and just changes the theme name and template.

    style.css

    <?php
    /*
     Theme Name:   <<your theme name >>
     Theme URI:    http://example.com/twenty-twelve-child/
     Description:   Child Theme description
     Author:       your name
     Author URI:   site url
     Template:     twentytwelve
     Version:      1.0.0
     License:      GNU General Public License v2 or later
     License URI:  http://www.gnu.org/licenses/gpl-2.0.html
     Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
     Text Domain:  twenty-fifteen-child
    */
    ?>

    functions.php

    <?php
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    
    }
    ?>

    To create your template You need to create a template file which is very easy.

    just create a file with this header

    <?php
    /*
     Template Name: Full Width Page
    
    */

    if you look in the twentytwelve folder you will see a folder called page-templates open the file called full-width.php. You will want to copy everything except the comments at the top. Starting at the line that starts with get_header() and paste it into your new template under your header.

    Should look something like this.

    <?php
    /**
     * Template Name: nonav
     *
     *
     */
    
    get_header('nonav'); ?>
    
    	<div id="primary" class="site-content">
    		<div id="content" role="main">
    
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', 'page' ); ?>
    				<?php comments_template( '', true ); ?>
    			<?php endwhile; // end of the loop. ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Save it with the name you want to call your template you could call it for example you could call it landingpage.php.

    You will next need to create a new header called header-nonav.php.
    To do this open the header.php file. delete the section for the navigation

    ` <nav id=”site-navigation” class=”main-navigation” role=”navigation”>
    <button class=”menu-toggle”><?php _e( ‘Menu’, ‘twentytwelve’ ); ?></button>
    <a class=”assistive-text” href=”#content” title=”<?php esc_attr_e( ‘Skip to content’, ‘twentytwelve’ ); ?>”><?php _e( ‘Skip to content’, ‘twentytwelve’ ); ?></a>
    <?php wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘menu_class’ => ‘nav-menu’ ) ); ?>
    </nav><!– #site-navigation –>`

    and save it as header-nonav.php and you should be done.

    When you create a new page you will see a drop down called templates just select the template you created and it should work for you.

    Sorry the post is so long.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to remove navigation from one page only’ is closed to new replies.