Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm in the technical planning stages of a project which i intend to implement a 'Single Page Layout' on.

I've setup the pages 'people', 'clients', 'contact', 'case studies' etc and taken the content into my Front Page template using the get_page() function, feeding it the page IDs. This works OK.

I'm intending to have the top navigation menu items, when selected, navigate down the page to there respective section and update the url accordingly.

e.g - Select on 'people' (scrolls down page to 'people' section), url updates to example.com/people

however, the url is in conflict, since the 'people' content is setup as a page. And the end-user will be taken away from the front page.

Is there best practice for getting around this?

Thanks in advance, Cam

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You can handle that with a hash (the way javascript does by default) and have the url become example.com#people, or any other delimiter really. It should be as simple as changing the character you're parsing the url for.

UPDATE: Example code as per comments

$args = array(
    'label'               => 'Your Label',
    'labels'              => $labels,  //define this elsewhere
    'public'              => false,
    'publicly_queryable'  => true,
    'exclude_from_search' => true, //change this if needed
    'show_ui'             => true,
    'show_in_menu'        => true,
    'menu_position'       => 20,
    'supports'            => array(
        'title',
        'editor',
        'author',
        'custom-fields',
        'revisions'
    ),
    'taxonomies'          => array(
        'category'
    ),
    'has_archive'         => false,
    'show_in_nav_menus'   => true
);
register_post_type( 'single-pages', $args );

http://codex.wordpress.org/Function_Reference/register_post_type for documentation, you'll probably needa drop/tweak some of those args to meet your spec on the project and you definitely need to setup the labels for usability if it's a client's site, but that should get you going. This code is untested (I wrote it directly into the textarea, so forgive any typos).

share|improve this answer
    
it would be ideal not the have the example.com/people url created at all when the page is published for SEO reasons also.. i wouldnt want people navigating to any page outside the front page thro search results –  Cam Jan 8 '12 at 0:43
    
I'm not sure I understand the question then. Are you dynamically loading the content from the people page and then scrolling to it, or is there a people section on the homepage that you are taking the user to? –  m0r7if3r Jan 8 '12 at 0:48
    
sorry, i've created the page 'people', and published it. The content from that page is then taken into my frontpage template using the get_page(). this has been repeated for 5 different pages. so all site content is on my 'Single Page Layout'. if that makes sense? –  Cam Jan 8 '12 at 0:53
    
'Single Page Layout' make be the wrong term.... 'One Page Layout' –  Cam Jan 8 '12 at 0:58
    
Ah, I see. Have you considered registering a non-publiclly viewable custom-post-type to do this? I'll edit my answer shortly with example code. –  m0r7if3r Jan 8 '12 at 2:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.