Community Forums › Forums › Archived Forums › Design Tips and Tricks › Can't get custom home template to work
- This topic has 1 reply, 1 voice, and was last updated 9 years, 7 months ago by thoughtwell.
-
AuthorPosts
-
January 14, 2015 at 4:35 pm #137489thoughtwellMember
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!
http://summithmeinc.com<?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();
May 5, 2015 at 5:24 pm #150303thoughtwellMemberI 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.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.