Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8861691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:32:51+00:00 2026-06-14T15:32:51+00:00

Hi What i’m trying to do is in the page.php file set up a

  • 0

Hi What i’m trying to do is in the page.php file set up a bunch of if statements for each page for example if page == aboutus display the about us content and so on. at the moment no matter what page i’m on it’s displaying everything in the page.php file i’m sure its just something with the way i have written it. does anyone know what i’m doing wrong?

heres what i have so far

<?php get_head(); ?>

<?php is_page($page); ?>

<?php is_page('about-us'); ?> {

    <div id="container">
    <?php get_header(); ?>
    <?php get_banner(); ?>

        <div class=" center content" role="main">
            <div id="posts">
                <span class="title">About Us</span>     

                <div class="msghead">
                <?php query_posts('cat=7&showposts=1&orderby=date'); while (have_posts()) : the_post(); the_content(); 
                endwhile;?>
                </div>



             </div>

                   <div id="sidebardiv">
                <?php get_sidebar(); ?> </div>
                <div class="clear"> </div>

          </div>

       </div>
    <?php get_footer(); ?>

    </div>

}

<?php is_page('classes'); ?> {

    <div id="container">
    <?php get_header(); ?>
    <?php get_banner(); ?>

        <div class=" center content" role="main">
            <div id="posts">
                <span class="title">Classes</span>     

                <div class="msghead">
                <?php query_posts('cat=7&showposts=1&orderby=date'); while (have_posts()) : the_post(); the_content(); 
                endwhile;?>
                </div>



             </div>

                   <div id="sidebardiv">
                <?php get_sidebar(); ?> </div>
                <div class="clear"> </div>

          </div>

       </div>
    <?php get_footer(); ?>

    </div>

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:32:52+00:00Added an answer on June 14, 2026 at 3:32 pm

    You are not actually checking the page, you are just running the is_page() function, then displaying the content.

    Additionally, when you use The Loop, you should first check that there are posts to display, to avoid errors.

    And just as a tip – if the only difference in the pages is the posts that are shown, you can set your arguments before the loop, that way you can cut out quite a lot of your code. Here is a link to a Pastebin with an example of that method, taking the below. Furthermore, if the template is page.php, then the Page that you are viewing is already in the Loop, so you can make use of that to show the Page title. This is untested, but should get you started.

    <?php get_head(); ?>
    
    <?php if(is_page('about-us')) : ?>
    
        <div id="container">
        <?php get_header(); ?>
        <?php get_banner(); ?>
    
            <div class=" center content" role="main">
                <div id="posts">
                    <span class="title">About Us</span>     
    
                    <div class="msghead">
                    <?php
                    query_posts('cat=7&showposts=1&orderby=date');
                    if(have_posts()) : while (have_posts()) : the_post();
                            the_content(); 
                        endwhile;
                    endif;
                    ?>
                    </div>
    
    
    
                 </div>
    
                       <div id="sidebardiv">
                    <?php get_sidebar(); ?> </div>
                    <div class="clear"> </div>
    
              </div>
    
           </div>
        <?php get_footer(); ?>
    
        </div>
    
    <?php elseif(is_page('classes')) : ?>
    
        <div id="container">
        <?php get_header(); ?>
        <?php get_banner(); ?>
    
            <div class=" center content" role="main">
                <div id="posts">
                    <span class="title">Classes</span>     
    
                    <div class="msghead">
                    <?php
                    query_posts('cat=7&showposts=1&orderby=date');
                    if(have_posts()) : while (have_posts()) : the_post();
                            the_content(); 
                        endwhile;
                    endif;
                    ?>
                    </div>
    
    
    
                 </div>
    
                       <div id="sidebardiv">
                    <?php get_sidebar(); ?> </div>
                    <div class="clear"> </div>
    
              </div>
    
           </div>
        <?php get_footer(); ?>
    
        </div>
    
    <?php endif; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm trying to create an if statement in PHP that prevents a single post
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm parsing an XML file, the creators of it stuck in a bunch social
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.