The MU forums have moved to WordPress.org

How do i create a second page besides index.php? (40 posts)

  1. iwillpayou
    Member
    Posted 14 years ago #

    How do I create a second page besides index? Say if i want to run myotherpage.php how would I go about having to main pages? It won't matter if its in another folder.

  2. andrea_r
    Moderator
    Posted 14 years ago #

    It depends. What do you want on it? What do you want it to do?

  3. iwillpayou
    Member
    Posted 14 years ago #

    I want it to do the exact same thing as the homepage does

  4. jameslaws
    Member
    Posted 14 years ago #

    Are you asking how to have a custom page as your homepage instead of the main blog page?

  5. iwillpayou
    Member
    Posted 14 years ago #

    in a way. I want to have my index.php with my regular theme. Then I want something like myblog.php with all the same stuff but a different theme..

  6. jameslaws
    Member
    Posted 14 years ago #

    Perhaps you could share your use case for this site. It sounds like you want to be able to simply switch themes but I suspect that you have something specific you are trying to accomplish. If you can share what you will be doing with the site we will have a better chance of telling you how to get there.

  7. iwillpayou
    Member
    Posted 14 years ago #

    I want to be able to have a regular index.php page. Then have something like myblog.php with all the same content except for a different theme.I really just need a second working page.. it doesn't matter about the theme so much because i can edit that myself down the road. I just don't know how to have a second index page to get it working with all the same content thats on the same site. I want to do this so i can use a iframe to display myblog.php on another site. with another

  8. iwillpayou
    Member
    Posted 14 years ago #

    I tried to copy and paste index.php and save it as index2.php it works but with out the content from the authors. Or it just forwards to index.php

  9. iwillpayou
    Member
    Posted 14 years ago #

    i really just want to copy and paste index.php and save it as index2.php and get it working.. if i could do that.. that would be wonderful too

  10. jameslaws
    Member
    Posted 14 years ago #

    Ok, so you want to be able to go to yoursite.com/my-second-index and basically see your site as if you visited the main page.

    Add something like this to the top of your index page and rename it to something like "index2.php" or whatever you want to call it.

    <?php
    /*
    Template Name: My Second Index
    */
    ?>

    The create a new page in your site and and choose the "My Second Index" under the template when you create the page.

    Not sure it's the best way but it works.

  11. iwillpayou
    Member
    Posted 14 years ago #

    i got a error - Warning: Cannot modify header information - headers already sent by (output started at /home/user1aaa/public_html/index2.php:7) in /home/user1aaa/public_html/wp-includes/pluggable.php on line 868

  12. jameslaws
    Member
    Posted 14 years ago #

    Does the top of your page look something like this..

    <?php
    /*
    Template Name: My Second Index
    */
    get_header(); ?>

    If not could you paste what it does look like?

  13. iwillpayou
    Member
    Posted 14 years ago #

    <?php
    /**
    * Front to the WordPress application. This file doesn't do anything, but loads
    * wp-blog-header.php which does and tells WordPress to load the theme.
    *
    * @package WordPress
    */

    /**
    * Tells WordPress to load the WordPress theme and output it.
    *
    * @var bool
    */
    define('WP_USE_THEMES', true);
    /** Loads the WordPress Environment and Template */
    require('./wp-blog-header.php');
    ?>

  14. jameslaws
    Member
    Posted 14 years ago #

    My bad for not explaining myself. This should be done with the index.php within your theme, not the main index.php of your install.

    That file should never be altered.

  15. iwillpayou
    Member
    Posted 14 years ago #

    ok i didn't have aligned right up at the top...

    but i am still getting the problem where it redirects to index.php also known as the main page.

  16. iwillpayou
    Member
    Posted 14 years ago #

    ok how would i view it then? mysite.com/index2.php?

  17. iwillpayou
    Member
    Posted 14 years ago #

    or would i view it mysite.com/wp-content/themes/index2.php

  18. jameslaws
    Member
    Posted 14 years ago #

    Is this an external site where you could provide the link to look at? That way I can see what you behavior you are having.

    I don't know what you mean by redirecting to the index.php. Do you mean you visit yoursite.com/imdex2 and it automatically redirects to yoursite.com/index.php ?

  19. jameslaws
    Member
    Posted 14 years ago #

    You would go to the new page you created in your backend. It will look like your index because it has all the same info but it would have a url of yoursite.com/yournewpage/

  20. iwillpayou
    Member
    Posted 14 years ago #

    currently its a inside site. well i want to be able to view index.php and index2.php how would i view index2.php ?

  21. iwillpayou
    Member
    Posted 14 years ago #

    i went to mysite.com/index2 and i can't view it.

  22. jameslaws
    Member
    Posted 14 years ago #

    You would view index.php by visiting yoursite.com and you would visit index2.php by visiting yoursite.com/the-page-you-created-in-your-admin-with-the-index-page-template-you-created-with-the-php-I-shared-above/

    You have to create a page in your admin with the page template we created above from your index.php file. When you create that page it give you the url right under the title.

  23. iwillpayou
    Member
    Posted 14 years ago #

    ok i know what did wrong i forgot to select it. Thank you.. this may just work...

  24. jameslaws
    Member
    Posted 14 years ago #

    Glad to hear it. Keep us posted. ;-)

  25. iwillpayou
    Member
    Posted 14 years ago #

    cool thank you so much.. ok.. my next trick is how do i get all the most recent site posts to show up?

  26. jameslaws
    Member
    Posted 14 years ago #

    From this current site or from all network sites? From this current site should be automatic. If you want it from all network sites, http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags should do the trick.

  27. iwillpayou
    Member
    Posted 14 years ago #

    I would like to pay you some money for all your help and your quickness..

  28. jameslaws
    Member
    Posted 14 years ago #

    It is totally not necessary. I'm happy to help and that's what these forums are for. If you ever need more substantial help with a project you can always look me up. ;-)

  29. iwillpayou
    Member
    Posted 14 years ago #

    you know what i did miss something.. its not pulling in the latest posts for some reason

  30. iwillpayou
    Member
    Posted 14 years ago #

    I mean its not pulling in any posts.. is there a setting for this somewhere?

About this Topic

  • Started 14 years ago by iwillpayou
  • Latest reply from iwillpayou