WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Multiple Editable Regions (13 posts)

  1. David Calhoun
    Member
    Posted 4 years ago #

    Hi guys. I am still fairly new to WordPress, but I'm quickly falling in love with it's capabilities and community.

    I'm wanting to use WordPress as a CMS, and I am wondering how to make a single page, with multiple editable regions.

    I had seen some posts on other sites about using custom functions, the <!--nextpage--> tag, and some other things, but is there an easier way to make a page have different editable regions. And can they be formatted with CSS differently?

    I don't have a link to give you an example right now, but hopefully you can understand what I'm trying to accomplish. If not, I can try to find an example to use.

    Thanks.

  2. ImagineDesignEx
    Member
    Posted 4 years ago #

    One way I accomplish this is by using custom queries on the page. Essentially you create categories and posts for the extra areas of content that you are trying to manage, and then you run a separate query within the page to pull in the content.

    Something like this:

    <?php $test = new WP_Query('category_name=main&showposts=1');
    while ($test->have_posts()) : $test->the_post(); ?>
    <div id="title">
    <h2>"><?php the_title(); ?></h2>
    </div>

    <?php the_content(__('Read more'));?>

    <?php endwhile;?>

    Make sure to replace the category_name with your category name (actually its the category slug so make sure to double check that) and change the $test variable to whatever you need it to be throughout the query.

    Good luck

  3. David Calhoun
    Member
    Posted 4 years ago #

    I'm not quite sure I'm understanding this. Are you saying using "posts" as the different regions on a single page? Assigning different categories to the posts and only calling that specific category?

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    That's pretty much it in a nutshell, yes. I suppose it all boils down to how much content you want to be able to add to these additional regions and how much flexibility you want. If it's just short snippets of text, another option might be to add a number of widget-capable areas to a template. Either way, you're likely to need at least 1 custom template -assuming you do mean a Pages and not a single post.

    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

  5. David Calhoun
    Member
    Posted 4 years ago #

    Well, yeah. I'm making custom templates.

    I'm using WordPress as a CMS, so I've created several different templates for several different page layouts. But the thing I'm trying to get around is having a templated page that has more than one "content" box.

    So that I can have two different <div>'s, that are both pulling dynamic information that can be edited in the WordPress Admin panel, and that are styled differently.

    So, when the page is generated, something like:

    <div1  class=first>
    Content 1
    </div1>
    <div2 class=second>
    Content 2
    </div2>

    And then either in a CSS file, or in-line code on the page template:

    .first {
         background-color: black;
    }
    
    .second {
         background-color: white;
    }
  6. s_ha_dum
    Member
    Posted 4 years ago #

    Then ImagineDesignEx's comment about creating multiple queries/Loops seem to be the thing.

  7. brockangelo
    Member
    Posted 4 years ago #

    Custom taxonomies may be what you are looking for.

    http://justintadlock.com/archives/2009/05/06/custom-taxonomies-in-wordpress-28

  8. David Calhoun
    Member
    Posted 4 years ago #

    So, it seems like the only way to accomplish this is through use of posts, and not actual "page" content.

  9. s_ha_dum
    Member
    Posted 4 years ago #

    The trick is populating the 'content boxes' you've created. If you want to create that content without writing a whole new 'MySpecialPosts' management page, you've basically got posts or pages. I think 'posts' are the best fit. You can use pages to do it, but a number WP core functions and plugins generate navigation links from the pages, so you've got that to deal with if you use pages.

  10. jessn
    Member
    Posted 4 years ago #

    There's always Flutter to create custom write panels too if you're up for it http://flutter.freshout.us/

  11. David Calhoun
    Member
    Posted 4 years ago #

    Flutter looks interesting. It might be what I'm looking for, but I don't know. I'll have to dive into deeper and see.

    Thanks for the link!

  12. David Calhoun
    Member
    Posted 4 years ago #

    Thank you guys for all the helpful information. I decided the best/easiest way to accomplish the "multiple editable regions on a page" was with the posts category idea or something similar.

    I created a new posts category called "Home Sub Sections." And whenever I need to bring in that information on the home page, I used:

    <?php query_posts('category_name=Home Sub Sections); ?>

    or I will call that specific post number with:

    <?php query_posts('p=61') ?>

    So, now I have my multiple editable regions, and for my "News" page that uses the normal post timeline, I just removed all posts in the category "Home Sub Sections" from being queued into the timeline on that page with:

    <?php query_posts('cat=-3'); ?>

    Once again, thanks for all the help. And if anyone ever runs into this problem, the link below is also helpful with dealing with this:

    http://codex.wordpress.org/Template_Tags/query_posts

  13. David Calhoun
    Member
    Posted 4 years ago #

    I've now moved to using Magic Fields. The guys developing this plugin are awesome, and extremely helpful.

    Their plugin allows you to create all kinds of Write Panels with custom fields. Just what I needed.

    http://magicfields.org/

Topic Closed

This topic has been closed to new replies.

About this Topic