• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Can't get custom home template to work

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Can't get custom home template to work

This topic is: resolved

Tagged: custom page templates, genesis_after_header

  • This topic has 1 reply, 1 voice, and was last updated 10 years, 7 months ago by thoughtwell.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • January 14, 2015 at 4:35 pm #137489
    thoughtwell
    Member

    I have built a home.php file using the code below. For some reason, it doesn't seem like the action hook is working for genesis_after_header()... all the other widget areas are working for the 'mrqee' container. I'm stumped. You can see this on my homepage at summithmeinc.com

    If anyone w/ some php chops can take a look at this and let me know why, it would be greatly appreciated. The page isn't broken, but the hook isn't outputting. I did use a conditional " if(is_home() || is(front_page)); " in the simple hooks plugin for the related action and that seemed to work, but it output it on not only my home page but also my blog/news page (pages I have set in the reading menu under my WP settings.)

    I feel like I've looked over this a hundred times and I can't see what I am doing wrong. Any input is appreciated. Thanks!

    <?php
    /*
    Template Name: Home
    */
    
    get_header();
    
    function smt_homeslide_cta_combo(){
    	?>
    	<div class="slideshow-wrapitup">
    			<div class="wrap">
    	            <div class="flexslider">
    					<ul class="slides">
    					<?php
    
    					$loop = new WP_Query(array('post_type' => 'smt_hm_slide', 'posts_per_page' => -1, 'orderby'=> 'ASC')); 
    
    						while ( $loop->have_posts() ) : $loop->the_post(); ?>
    
    						<li>
    							<div class="slide">
    								<?php $url = get_post_meta($post->ID, "url", true);
    								if($url!='') { 
    									echo '<a href="'.$url.'">';
    									echo the_post_thumbnail('full');
    									echo '</a>';
    								} else {
    									echo the_post_thumbnail('full');
    								} ?>
    								<div class="caption">
    									<h5><?php the_title(); ?></h5>	
    									<?php the_content();?>
    								</div>
    							</div>
    						</li>
    
    						<?php endwhile; ?>
    						
    						<?php wp_reset_query(); ?>
    
    					</ul>
    	            </div><!-- end flexslider -->
    			</div><!-- end wrap -->
    		</div><!-- end slideshow-wrapitup -->
    
    		<?php 
    
    		genesis_widget_area( 'cta-1', array(
    					'before' => '<div class="ctawrap"><div class="wrap"><div id="cta1">',
    					'after' => '</div></div></div>',
    				) );
    }
    
    add_action('genesis_after_header' , 'smt_homeslide_cta_combo');
    
    ?>
    
    <div id="mrqee-area">
    	<div class="wrap">
    <?php
    genesis_widget_area( 'marquee1', array(
    			'before' => '<div class="marquee1 widget-area">',
    			'after' => '</div>',
    		) );
    
    genesis_widget_area( 'marquee2', array(
    			'before' => '<div class="marquee2 widget-area">',
    			'after' => '</div>',
    		) );
    
    genesis_widget_area( 'marquee3', array(
    			'before' => '<div class="marquee3 widget-area">',
    			'after' => '</div>',
    		) );
    ?>
    </div><!-- end wrap -->
    </div><!-- end mrqee-area -->
    <?php
    
    //* genesis();
    get_footer();
    http://summithmeinc.com
    May 5, 2015 at 5:24 pm #150303
    thoughtwell
    Member

    I suspect it may have something to do w/ the way I have the site's settings to display the home page. In the settings, I have the front page set to a page titled, 'home' in my pages. I then used a template file simply labeled 'home.php' but looking back, I probably should have named the file 'page-home.php' or 'front-page.php' and it would probably work as I originally intended.

    Ultimately, I just used a conditional in the genesis simple hooks plugin under the genesis_after_header Hook for to get this to work by inserting:

    <?php
    if( is_front_page() ) { ?>	
    <div class="slideshow-wrapitup">
    			<div class="wrap">
    	            <div class="flexslider">
    					<ul class="slides">
    					<?php
    
    					$loop = new WP_Query(array('post_type' => 'smt_hm_slide', 'posts_per_page' => -1, 'orderby'=> 'ASC')); 
    
    						while ( $loop->have_posts() ) : $loop->the_post(); ?>
    
    						<li>
    							<div class="slide">
    								<?php
    								$url = get_post_meta(get_the_ID(), 'url', true);
    								if( ! empty($url)) { ?>
    									<a href="<?php echo $url ?>">
    									<?php
    									the_post_thumbnail('full');
    									?>
    									</a>
    									<?php
    								} else {
    									echo the_post_thumbnail('full');
    								} ?>
    								<div class="caption"><?php
    								if( ! empty($url)) {
    									?>
    									<a href="<?php echo $url ?>"><h5><?php the_title(); ?></h5></a>
    									<?php
    								} else { ?>
    									<h5><?php the_title(); ?></h5><?php
    								}
    									the_content();?>
    								</div>
    							</div>
    						</li>
    
    						<?php endwhile; 
    						
    						wp_reset_query(); ?>
    
    					</ul>
    	            </div><!-- end flexslider -->
    			</div><!-- end wrap -->
    		</div><!-- end slideshow-wrapitup -->
    
    		<?php 
    
    		genesis_widget_area( 'cta-1', array(
    					'before' => '<div class="ctawrap"><div class="wrap"><div id="cta1">',
    					'after' => '</div></div></div>',
    				) );
    }
    
    ?>

    ... and then the rest of my 'home.php' template file kicks in. The 'home' page in my pages is just left blank. Probably a more efficient way to do this would be to combine everything into one file, renamed 'front-page.php' but at this point, I've moved on... so I will mark as resolved.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble