WordPress.org

Support

Support » How-To and Troubleshooting » custom sections

custom sections

  • I want to make different sections for my site where each section’s layout differs slightly with the other ones. Because of this, the wordpress pages wouldn’t cut it for me. I am looking for a way to redirect users to custom php files.

    e.g. my theme folder could look like this
    theme/section1.php
    theme/section2.php
    theme/home.php
    theme/header.php
    theme/index.php
    theme/footer.php

    and my URIs for them could be
    mydomain.com/section1/
    mydomain.com/section2/

    I was thinking of using a simple php script at index.php like this:


    if( $_SERVER['REQUEST_URI'] == '/section1/' ) {
    include( './section1.php' );
    } elseif { $_SERVER['REQUEST_URI'] == '/section2/' ) {
    include ( './section2.php' );
    } else {
    include ( './home.php' );
    }

    home.php would be the homepage.
    section1.php and section2.php would be my section files.

    Would this be a feasible way around it?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘custom sections’ is closed to new replies.
Skip to toolbar