WordPress.org

Forums

[resolved] How to call pages with custom layouts and permalinks properly? (2 posts)

  1. want_to_learn
    Member
    Posted 2 years ago #

    I have a customized theme (using Sandbox theme as base) where I use custom page layouts. If I need to call a custom page, I do something like this in page.php (at the template):

    <?php
    	if ($_GET['page_id']=='7') include(TEMPLATEPATH.'/custom_contacts.php');
    	else if ($_GET['page_id']=='2')	include(TEMPLATEPATH.'/custom_gallery_main.php');
    	else if ($_GET['page_id']=='5')	include(TEMPLATEPATH.'/custom_web.php');
    ?>
    .

    I always thinked that this is a primitive way, and there should be more clever solution. But it worked, so left it at is.

    Now I need to use custom permalinks, for example, http://www.example.com/about-me/ instead of http://www.example.com/?page_id=7 , so my way of getting custom page layout doesn't work. How should I do it properly?

    Thanks for help :)

  2. want_to_learn
    Member
    Posted 2 years ago #

    Sorry, found that I need to use page attribute "template".

Topic Closed

This topic has been closed to new replies.

About this Topic