September 4, 201412 yr Is there a way to have something show up on JUST the front page and not page 2, 3, 4, etc.? <?php if( is_front_page() ) : ?> <div> <iframe width="640" height="360" src="//www.youtube.com/embed/oCQ3weRdo" frameborder="0" allowfullscreen></iframe> </div> <?php endif; ?>
September 4, 201412 yr I assume, this is WP? If so, on top of my head: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; if( is_front_page() && $paged == 1 ) { ?> <div> <iframe width="640" height="360" src="//www.youtube.com/embed/oCQ3weRdo" frameborder="0" allowfullscreen></iframe> </div> <?php } ?> Hope that helps Edited September 4, 201412 yr by teodora
September 4, 201412 yr Author So... that totally worked (yes it is WP btw). Let my ask you this. This code I've placed in the index.php file on the main theme. Is it possible to place it in the functions.php file and have it appear in the same place on the theme? Here's what I have: get_header(); // Loads the header.php template. ?> <?php do_atomic( 'before_content' ); // origin_before_content ?> <div id="content"> <?php do_atomic( 'open_content' ); // origin_open_content ?> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; if( is_front_page() && $paged == 1 ) { ?> <div id="welcoming"> <iframe width="640" height="360" src="//www.youtube.com/embed/oCQ3weRdo" frameborder="0" allowfullscreen></iframe> </div> <?php } ?> <div class="hfeed"> <?php if ( have_posts() ) : ?> Can I place it there from the child theme functions.php file? There is actually a feature called 'sticky post' on the theme I'm using: http://demo.alienwp.com/origin/ If I could populate that area through the functions.php file that would be awesome!! I'm assuming it's an if statement since it only appears if you stick one of your posts. Thanks so much for your help already!
September 5, 201412 yr Better option would be just to copy your parent theme's index.php to your child theme. Child's index.php is supposed to override the parent's index.php. Then place the code in child's index.php where you want it to appear
Create an account or sign in to comment