• Resolved David Beck

    (@davbeck)


    How would you go about creating a page that has a custom layout to it. Not just a custom template but a layout that may have several content regions.

    I could create a custom template I suppose. But then I would have to edit the template every time I changed the content.

Viewing 9 replies - 1 through 9 (of 9 total)
  • davbeck,
    i have exactly the same problem and was just going to ask this on the forum right now.
    i dont want to hijack your topic...but its better than opening a new topic with the same problems only 30 minutes after you did. hope you don`t mind.

    basically i`m using WP as a CMS for a static page, and the homepage has several content regions. see here .
    the 3 boxes towards the bottom of the page are hardcoded into the template file, but i want to be able to edit the text, pictures and “read more” links directly from the backend.

    how can this be done?

    thanks!

    Thread Starter David Beck

    (@davbeck)

    That’s a perfect example of what I am also trying to do.

    You could widgetize the custom template and use the Text widget to add additional boxes to your page. Or you could get into multiple Loops if you want pull content from multiple categories, posts and/or pages.

    http://codex.wordpress.org/The_Loop#Multiple_Loops

    thanks, esmi, i`ll look into the text widget solution.

    pulling text from different pages/posts was a solution i thought of, but it meant that you had to edit a separate page for each box, which is not practical. i wanted to be able to edit all 3 boxes from inside the same page in the backend.

    davbeck:
    i`ll try it out tomorrow and post the results here.

    In addition to what esmi mentioned above, one of the simplest ways to do what you want is — if you can edit or know how to edit your theme template file, you can add different text areas by using wp_query function wherein
    a) add the query e.g. below where you want to add the text area in your theme template,

    <div id="info-one">
    <?php $the_query = new WP_Query('pagename=titleofpage');
    while ($the_query->have_posts()) : $the_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    <h3 class="infoclass"><?php the_title(); ?></h3>
    <?php the_content(); ?>
    <?php endwhile; ?>
    </div>

    b) add a new Page named per the pagename you made above (in this case, my example was titleofpage) then add your text and/or add maps or audio file of image. Remember all that you add in that page will appear in the div above.
    c) then so that these textareas you added are not included in main navigation and dropdowns, either hardcode exclusion of those pages or download plugin “Exclude Pages from Navigation” and uncheck the include box so that those special pages won’t be included.

    Thread Starter David Beck

    (@davbeck)

    Thanks. The wp_query method is probably what I will use.

    It would be nice if WordPress could work better with custom designed pages but I guess WordPress is already kind of extended itself past it’s blog core.

    Well, the method I posted above is one of many ways to implement different text areas. If the WP is your own and you are comfortable with HTML and PHP, then you could also use the include tags to include any template. Just create the template like textarea1.php and add to your theme folder with info you want inside and then add the include path to that specific template in the page your want with
    <?php include( TEMPLATEPATH . '/textarea1.php' ); ?>

    ok, i`ve played with the following solutions:
    (see here: http://www.szek.net/mjet/en/ )

    1. Widgets in the template:
    cons: you can only add basic text & a title. also, it displays by default as UL LI, but you can change that too if you know PHP ( see here: http://automattic.com/code/widgets/themes/ )
    if you know PHP, i bet you can do a lot more.

    2. wp_query funtion:
    (see the 2 Teasers at the bottom)
    simple method of calling page content into the template. you can add text, style it, add html, pictures, etc.
    cons: you must create a separate page for each teaser and edit the content of each page (hence teaser) separately.

    thanks guys for your help.

    Nice project, clean layout, best wishes 🙂

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Custom layout pages’ is closed to new replies.