0
votes

I have integrated Bootstrap 3 into Wordpress but now I am a little confused. I have created a new theme with the files index.php, header.php, footer.php, functions.php & single.php. I have also pulled in a menu which allows me to customize in anyway I want to called navwalker.php which is included in my functions.php file.

Everything works perfectly so my posts are showing on the index page etc, but they also show on every single page - my other pages I have created via Wordpress admin are showing the menu and I can click through them but the content on index.php is showing on every page - how do I just show this on the home page and nothing else?

Here is the code from the my index page.

<?php get_header(); ?>
    <div class="jumbotron">
        <div class="container">
            <center><h1>site name</h1></center>
            <br  />
            <center><h4>Lorem ipsum</h4></center>
        </div>
    </div>

    <div class="container"  style="background-color: rgba(255,255,255,0.3); padding-top:20px; color: #FFF;">
        <div class="page-header" style="border-bottom: none;">
            <center><h3>FROM THE BLOG</h3></center>
        </div>
    </div>

    <div class="container"  style="background-color: rgba(255,255,255,1.0); padding-top: 1px; border-top: 3px solid #f6c52d; padding-top: 20px; margin-bottom: 20px;">
        <div class="row">
            <div class="col-md-8">
                <div class="panel panel-default" style="border: none;">
                    <div class="panel-body">
                        <div class="page-header">
                            <h3>Latest news</h3>
                        </div>                        

                        <?php query_posts('posts_per_page=3'); while(have_posts()) : the_post(); ?> 
                        <?php the_post_thumbnail( 'medium' ); ?>                    
                            <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>                     
                            <p><?php the_excerpt(); ?></p>
                            <p class="text-muted">Posted by <?php the_author(); ?> on <?php the_time('F jS, Y'); ?></p>
                        <?php endwhile; wp_reset_query(); ?>
                    </div>                      
                </div>
            </div>

            <div class="col-md-4">
                <div class="panel panel-default"style="border: none;">
                    <div class="panel-body">
                         <div class="page-header">
                             <h3>Weather info</h3>
                         </div>

                         <a href="findus.html">
                             <img src="<?php bloginfo('template_url')?>/img/lake.png"  style="width: 100%;"/>
                         </a>                                                                
                     </div>
                 </div>
             </div> 
         </div>
     </div>                
 <?php get_footer(); ?>
1

1 Answers

0
votes

Ok I think I have figured it out - in my menu options I have the ability to use URLs to link directly to my custom pages. I will do it this way.

I had to include a bit of php into the page:

<?php
/*
 * Template Name: Contact Page
 * Description: A Page Template with a darker design.
 */

// Code to display Page goes here...

?>

And from the Wp Admin screen on the page I had to assign the page template on the drop down this is working fine for me!