Forums

Problem with static page (3 posts)

  1. subirghosh
    Member
    Posted 6 years ago #

    (i) I have created a page called About Us.
    (ii) I wanted to show it as domainname/aboutus.php instead of domainname/?page_id=xxx
    (iii) So I created a page called aboutus.php in the same folder as index.php but the content is not showing up.

    Here is how I have called it:

    BEGIN

    <?php
    require('./wp-blog-header.php');
    ?>
    <?php get_header(); ?>
    <!--general site stuff -->
    <?php query_posts('pagename=aboutus'); ?>
    <!--general site stuff -->
    <?php get_footer(); ?>

    END

    It is drawing a blank even when I call
    <?php query_posts('page_id=953'); ?>
    All the navigation stuff etc is showing up perfect.

    What can I be doing wrong?

  2. subirghosh
    Member
    Posted 6 years ago #

    Sorry, forgot to add this in my previous post:
    <?php query_posts('pagename=aboutus'); ?> is followed by
    <?php the_title(); ?>
    <?php the_content(''); ?>

    The content does not show, but the title does

  3. alrescha
    Member
    Posted 6 years ago #

    When you create a page, look on the right hand side, there's a section titled "Post Slug". If you enter "aboutus" in that text box and save the post, you'll find that you can link to it using domain/aboutus/ instead of the query string format. You don't need to create an about.php as you described above.

    This works for normal posts as well.

    PS: On this forum, it's better to use the EDIT link and edit your old post to add info, instead of replying to it. Some people (like me) look for posts with no replies first.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags