Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Custom Page Template needs editing WordPress

  • SOLVED

I'm trying to create a simple custom-page-template that is full-width for a site using Genesis Framework. Is this correct?

<?php
/*
Template Name: page-fullwidth.php
*/
?>
<?php genesis_before_content_sidebar_wrap(); ?>
<div id="content-sidebar-wrap">
<?php genesis_before_content(); ?>
<div id="content" class="hfeed">
<?php genesis_before_loop(); ?>
<?php genesis_loop(); ?>
<?php genesis_after_loop(); ?>
</div><!-- end #content -->
<?php genesis_after_content(); ?>
</div><!-- end #content-sidebar-wrap -->
<?php genesis_after_content_sidebar_wrap(); ?>

// Force full width page layout
add_filter( ‘genesis_pre_get_option_site_layout’, ‘__genesis_return_full_width_content’ );
genesis( );

Answers (1)

2015-08-09

timDesain Nanang answers:

You can try the following code:

<?php
/*
Template Name: page-fullwidth.php
*/

//===start===================
//you can move following code into functions.php

//add wrap before content
add_action( 'genesis_before_content', 'wpq_before_content' , 5 );
function wpq_before_content(){
?><div id="content-sidebar-wrap"><?php
}

add_action( 'genesis_after_content', 'wpq_after_content' );
function wpq_after_content(){
?></div><?php
}

//add id before loop
add_action( 'genesis_before_loop', 'wpq_before_loop' , 5 );
function wpq_before_loop(){
?><div id="content" class="hfeed"><?php
}

add_action( 'genesis_after_loop', 'wpq_after_loop' );
function wpq_after_loop(){
?></div><?php
}
//===end===================

//force full width page layout
add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' );

genesis();


Avonnes comments:

Thank you, timDesain Nanang, this worked perfectly!