Support » Theme: Tonic » Custom page template without right sidebar

Viewing 11 replies - 1 through 11 (of 11 total)
  • Create a new file called full-width.php inside your templates directory and paste this code –> http://pastebin.com/Fnt6Hcg3

    I created it by copying page.php, then removed get_footer() function and copied the contents of footer.php into it.

    After that I removed the following code

    if ( 5 != $bavotasan_theme_options['layout'] )
    	get_sidebar();
    ?>

    I tried to remove this get_sidebar() function by hooking and applying filters but couldn’t make it work which is why I manually copied the footer code into this template and removed that function.

    No!

    @jesin: Please stop advising people to edit WPORG themes!

    @exceldevelopers: Do not edit the theme itself. First create a child theme for your changes.

    @esmi

    Create a new file called full-width.php inside your templates directory

    does this come under “editing themes”? does upgrading a theme wipe manually created files ?

    Yes!

    @esmi: Just now tried it with an older version of this theme and you were right! I never thought newly created files would be deleted. I’ll include it the next time I advise someone 🙂 And thanks for making me aware of this.

    Thread Starter exceldevelopers

    (@exceldevelopers)

    so should i:

    create child theme
    copy parent theme page.php to child them and rename to page-fullwidth (say)
    make changes to page-fullwidth as Jesin suggested?

    I did all that but it doesn’t seem to pick up that there is now a custom page template available. I have page.php in parent them and page-fullwidth.php in child theme. I presume I should be doing something differently, but what? place a copy of page.php in child theme?

    Did you activate your child theme ?

    Thread Starter exceldevelopers

    (@exceldevelopers)

    Yes. But I forgot to name the custom page template:

    /**
    Template Name: Full Width
     */

    Once I did that, I was able to select the page template for the page I am editing, but the right sidebar still shows. Sigh. Here is the custom page template code:

    <?php
    /**
    Template Name: Full Width
     */
    $bavotasan_theme_options = bavotasan_theme_options();
    get_header(); ?>
    
    	<div style="width:100%" id="primary" <?php bavotasan_primary_attr(); ?>>
    
    		<?php
    		while ( have_posts() ) : the_post();
    			?>
    			<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    				<h1 class="entry-title"><?php the_title(); ?></h1>
    
    			    <div class="entry-content">
    				    <?php the_content( __( 'Read more →', 'tonic' ) ); ?>
    			    </div><!-- .entry-content -->
    
    			    <?php get_template_part( 'content', 'footer' ); ?>
    			</article><!-- #post-<?php the_ID(); ?> -->
    			<?php
    			comments_template( '', true );
    		endwhile; // end of the loop.
    		?>
    
    	</div><!-- #primary.c8 -->
    
    <footer id="footer" role="contentinfo">
    	<div id="footer-content" class="grid <?php echo $bavotasan_theme_options['width']; ?>">
    		<div class="row">
    			<p class="copyright c12">
    				<span class="fl"><?php printf( __( 'Copyright © %s %s. All Rights Reserved.', 'tonic' ), date( 'Y' ), ' <a href="' . home_url() . '">' . get_bloginfo( 'name' ) .'</a>' ); ?></span>
    				<span class="credit-link fr"><i class="icon-leaf"></i><?php printf( __( '%s created by %s.', 'tonic' ), BAVOTASAN_THEME_NAME, '<a href="https://themes.bavotasan.com">c.bavota</a>' ); ?></span>
    			</p><!-- .c12 -->
    		</div><!-- .row -->
    	</div><!-- #footer-content.grid -->
    </footer><!-- #footer -->
    
    <?php wp_footer(); ?>
    
    <!-- <?php echo BAVOTASAN_THEME_NAME; ?> created by c.bavota - https://themes.bavotasan.com -->
    </body>
    </html>

    [Moderator Note: Please post code or markup between backticks or use the code button. Or better still – use a pastebin. Your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

    Thread Starter exceldevelopers

    (@exceldevelopers)

    Wait. I published my page and now it works! Thanks Jesin for your help.

    Great! You’re welcome.

    Can you mark this thread as resolved if your problem has been solved.

    Thread Starter exceldevelopers

    (@exceldevelopers)

    Thanks Jesin.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Custom page template without right sidebar’ is closed to new replies.