How to have 2 separate page.php pages with different elements
-
Hi guys,
I am working on a project where my WordPress website must have 3 pages – all identical to the home page, with individual category feeds on each.
The pages are: News, Interviews & Features and each page contains a flex-slider playing top stories from the page category.The theme featured a different front page template to the back page so – I have achieved what I want on the first 2 pages by:
1/ Making the front page template the way I want & calling the “news” category feed.
2/ Pretty much duplicating the code in index.php over to page.php and then changing the feed on page.php to my new category “Interviews”.
3/ Calling a new flex-slider.php to only show stories from “Interviews”.That all works great but I am stuck now with how to create the code for my third page “Features”. I have created the page and it is displaying the right articles but – flex-slider shows images from “Interviews” because it is being called from Page.PHP.
Is there a way I can have a Page2.PHP so I can call a new instance of flex-slider? Either that or can anyone tell me how to edit my flex-slider code (below) to only show images from the page it is on?
<!-- .fluid_container--> <div class="fluid_container clearfix"> <!-- #camera_wrap_2 --> <div class="camera_wrap camera_orange_skin " id="camera_wrap_2"> <?php $flex_posts = new WP_Query(array( 'showposts' => 5, 'category_name' => 'interviews', ));?> <?php while($flex_posts->have_posts()): $flex_posts->the_post(); ?> <?php if(has_post_thumbnail()){ ?> <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); ?> <div data-thumb="<?php echo $image[0]; ?>" data-src="<?php echo $image[0]; ?>" data-link="<?php the_permalink(); ?>"> <div class="camera_caption moveFromLeft"> <div class="list-block-slide clearfix"> <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> </div> </div> </div> <?php } ?> <?php endwhile; ?> <?php wp_reset_query();?> </div><!-- /#camera_wrap_2 --> </div> <!-- /.fluid_container --> <div style="clear:both; display:block;"></div>
Any help would be greatly appreciated!
- The topic ‘How to have 2 separate page.php pages with different elements’ is closed to new replies.