Community Forums › Forums › Archived Forums › Design Tips and Tricks › show page content custom home template
- This topic has 6 replies, 3 voices, and was last updated 10 years, 4 months ago by Brad Dalton.
-
AuthorPosts
-
November 25, 2013 at 9:05 pm #75624dmcleod87Member
hi all,
i have started building a new site and i'm having trouble with a custom home template i've created. i've put it together from various sources. the code i used below displays the homepage content, but also displays all the websites pages as posts below the page content.
add_action('genesis_loop', 'custom_loop'); function custom_loop() { global $paged; $args = array('post_type' => 'page'); // Accepts WP_Query args // (http://codex.wordpress.org/Class_Reference/WP_Query) genesis_custom_loop( $args ); }
i've tried adding this query but it seems to do nothing
$query = new WP_Query( 'page_id=31' );
can anyone point me in the right direction? thanks!
http://grayking.dylanmcleod.net.au/November 25, 2013 at 11:26 pm #75646SummerMemberWhat happens when you scrap that template and just set that particular page to be your static front page in Settings > Reading?
Seems that might be the easier course of action, unless there's something else you were trying to achieve?
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkNovember 25, 2013 at 11:35 pm #75647dmcleod87Memberthat's what it's set to currently, but still shows the other pages as posts...all i want is the homepage content which is there, but without the other page content underneath...
November 26, 2013 at 7:36 am #75681Brad DaltonParticipantWhat theme are you using?
You could use a custom page template with widgets so the loop of posts is not displayed.
November 26, 2013 at 3:06 pm #75750dmcleod87Memberi'm using the genesis sample theme with a custom template and widgets, but need to show page content as well. full code for template is below -
<?php
/*
Template Name: Widget TemplateCreated for three featured widget section, by Iniyan-tweaky
*/
//Displaying posts on this page
remove_action( 'genesis_loop', 'genesis_do_loop' );add_action('genesis_loop', 'custom_loop');
function custom_loop() {
global $paged;$args = array('post_type' => 'page');
// Accepts WP_Query args
// (http://codex.wordpress.org/Class_Reference/WP_Query)// $query = new WP_Query( 'page_id=31' );
genesis_custom_loop( $args );
}
//Featured Widgets
add_action('genesis_before_content', 'iniyan_template');
function iniyan_template() {echo'<div id="tweaky-widgets">';
genesis_widget_area( 'home-featured', array(
'before' => '<div class="home-featured widget-area">',
'after' => '</div>',
) );genesis_widget_area( 'featured-one', array(
'before' => '<div class="featured-one">',
'after' => '</div>',
) );genesis_widget_area( 'featured-two', array(
'before' => '<div class="featured-two">',
'after' => '</div>',
) );genesis_widget_area( 'featured-three', array(
'before' => '<div class="featured-three">',
'after' => '</div>',
) );echo '</div>';
}
genesis(); // <- everything important: make sure to include this.
November 26, 2013 at 4:15 pm #75763dmcleod87Membernevermind figured it out. just had to remove custom loop and leave the widgets.
<?php /* Template Name: Widget Template */ //Featured Widgets add_action('genesis_before_content', 'iniyan_template'); function iniyan_template() { echo'<div id="tweaky-widgets">'; genesis_widget_area( 'home-featured', array( 'before' => '<div class="home-featured widget-area">', 'after' => '</div>', ) ); genesis_widget_area( 'featured-one', array( 'before' => '<div class="featured-one">', 'after' => '</div>', ) ); genesis_widget_area( 'featured-two', array( 'before' => '<div class="featured-two">', 'after' => '</div>', ) ); genesis_widget_area( 'featured-three', array( 'before' => '<div class="featured-three">', 'after' => '</div>', ) ); echo '</div>'; } genesis(); // <- everything important: make sure to include this.
November 27, 2013 at 2:23 am #75821Brad DaltonParticipantDon't think that will work as you register widgets in your child themes functions file not a template file.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.