Approach to one-page web in WordPress

One page web design has a little myth: Not dynamic enough. However, it is still possible to be dynamic using WordPress. Recently I found 2 ways to work-around it. 1: Widgetize the content area; 2: Page extract.

1: Widgetize the content are

I think there is no need much explanation on this one. Just create widget for specific area:

Widget

However, widget area doesn’t give you much “Dynamic” impact. The lack of visual editor, the need to use HTML tags and of course uploading an image. It will be a lot of job to start off, though updating is easier. That’s why I discovered another approach, the page extract.

2: Page extract

Time to revisit WP_Query again. Notice that is has pagename=my-page-name ready when query WordPress loop.

<?php
$the_query = new WP_Query('pagename=contact');

while ( $the_query->have_posts() ) : $the_query->the_post();
	echo the_content();
endwhile;

wp_reset_postdata();
?>

There I can query some pages I need on that one page. This can help editing the layout content, I gets all the visual editing, media uploading and etc. Just as per post/page editing. It helps a lot when creating for a client.

On part of the custom menu, it is like normal. I’m using <a name=""></a> approach, so instead of normal drag-and-drop, I go with custom link:
Custom menu

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>