• I’m trying to come up with a custom page template for the Twenty Fourteen theme. I need one page to use the full width available. On that page, you see, I’ll have a multi-column table, and the Twenty Fourteen theme isn’t conducive to such things.

    So here’s the page:
    http://www.heroicon.org/events-list/

    All I want is the header like it is, the footer like it is, but the middle section, the body, to take the full width of the area. IE, no sidebar, no widget area, no extra unused white space etc. Just plenty of room for my wide table.

    I’ve messed around with page templates and I’ve checked out the codex, but I cannot get it to work satisfactorily. Any help you can provide is appreciated. Thanks.

Viewing 15 replies - 1 through 15 (of 17 total)
  • I need to do exactly the same thing at http://devonweddingadvisor.co.uk/venues/
    so await replies with interest also, thanks.

    Thread Starter makphisto

    (@makphisto)

    Are you using Tablepress too, Jonnie?

    Hi makphisto,
    Yes, I am. Just put on a sample table to try it out, and it works great – apart from the lack of width on the page. Looking at your site, you have got more with than I have, not sure how you managed that, but if we can get even more that would be great!

    Thread Starter makphisto

    (@makphisto)

    I made the following Page Template.

    <?php
    /**
     * Template Name: No Sidebar, Full Width
     *
     */
    
    get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<div id="content" class="site-content" role="main">
    			<?php
    				// Start the Loop.
    				while ( have_posts() ) : the_post();
    
    					// Include the page content template.
    					get_template_part( 'content', 'page' );
    
    					// If comments are open or we have at least one comment, load up the comment template.
    					if ( comments_open() || get_comments_number() ) {
    						comments_template();
    					}
    				endwhile;
    			?>
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php
    get_sidebar();
    get_footer();

    Then, in Tablepress options, I put this custom CSS:

    #tablepress-1 {
    	width: 170% !important;
    }

    It works *okay*, but I think it could be so much better. Twenty Fourteen isn’t very forgiving.

    Wow, thanks for that! I’m not sure what to do with it yet, but it looks great! lol
    Seriously, thank you for sharing, I’m new to WordPress, so will have to do a bit of googling/reading up on page templates, but it will help me a lot, thanks again makphisto 🙂

    Thread Starter makphisto

    (@makphisto)

    You bet. Hopefully, someone will come along and solve all our problems. 🙂

    Thread Starter makphisto

    (@makphisto)

    Jonnie (and anyone else reading this). I ended up paying a developer to make this work for me. I thought you might like the code, too.

    <?php
    /**
     * Template Name: No Sidebar, Full Width
     *
     */
    
    get_header(); ?>
    
    <style>
    
    #secondary {
        display: none !important;
    }
    
    .site-content .entry-header, .site-content .entry-content, .site-content .entry-summary, .site-content .entry-meta, .page-content, .hentry, .entry-content {
        max-width: 1260px !important;
    }
    
    #tablepress-1 {
        width: 100% !important;
    }
    
    .site-content, .site-main .widecolumn {
    margin-left:0 !important;
    }
    
    .site-content {
    margin-right:0 !important;
    }
    
    .site:before {
    width:0px !important;
    }
    </style>
    
    	<div id="primary" class="content-area">
    		<div id="content" class="site-content" role="main">
    			<?php
    				// Start the Loop.
    				while ( have_posts() ) : the_post();
    					// Include the page content template.
    					get_template_part( 'content', 'page' );
    					// If comments are open or we have at least one comment, load up the comment template.
    					if ( comments_open() || get_comments_number() ) {
    						comments_template();
    					}
    				endwhile;
    			?>
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php
    get_sidebar();
    get_footer();

    Copy and past that into Notepad, save the file as no-sidebar-full-width.php (the PHP is important!). Using an FTP program, FTP that file to your server (/www/wp-content/themes/twentyfourteen/page-templates/). Then, in WordPress admin, change the page template of your page to “No Sidebar, Full Width”. Hope that helps!

    That helps enormously, thank you for sharing.

    So it doesn’t need to go into a child theme folder then, just ‘page-templates’. I guess when the theme updates, that folder is left untouched? I will try that out this evening, will be great to see my table in all it’s glory!

    Your site looks great btw, I will keep checking in on it, for ideas and tips!!

    Thanks again,
    Jonnie

    Thread Starter makphisto

    (@makphisto)

    Yep, page-templates folder should do nicely.

    I guess when the theme updates, that folder is left untouched?

    Nope. It will be over-written. Any changes should always be within a child theme.

    Thread Starter makphisto

    (@makphisto)

    Nope. It will be over-written. Any changes should always be within a child theme.

    Ah, ok, good to know. I unwisely presumed that since the child theme didn’t have a page-templates file in it, the template had to go to the parent theme. Thanks for setting us straight!

    ok esmi, so in a folder called ‘page-templates’ within a child theme folder?

    Thanks

    You could just drop the new template straight into the child theme’s folder. No real need for it to be in a sub-folder.

    ok, great, think I’ve got it now! Thanks

    Just an update, thanks to you guys even an idiot like me got it to work! Many thanks again.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Twenty Fourteen – Need Help With a Custom Page Template’ is closed to new replies.