Forums

Using WordPress as simple cms, couple basic questions... (5 posts)

  1. MikeTheVike
    Member
    Posted 4 years ago #

    I'm trying to figure out how I can have multiple content sections on one page which can be edited through wordpress.

    -First, on a template, will WordPress automatically put main content in a div called "content"?

    -what if i want multiple content divs on a single page? Much like the wordpress.org home page. Is it possible to have multiple editable content sections on a single page which can be edited through wordpress? If so, how would I set up the html? Do i need to give the divs special id's or something?

    -I noticed that some themes are "widget-ready" what does that mean? What has to be done to a template to make it "widget-ready"

    Thanks for any help!

  2. Ivovic
    Member
    Posted 4 years ago #

    -First, on a template, will WordPress automatically put main content in a div called "content"?

    Technically, your template will do that, or it won't do that. It has everything to do with your template and not much to do with wordpress itself.

    If you don't want that to happen you are free to adjust your template so it doesn't happen.

    what if i want multiple content divs on a single page? Much like the wordpress.org home page. Is it possible to have multiple editable content sections on a single page which can be edited through wordpress? If so, how would I set up the html? Do i need to give the divs special id's or something?

    It is, but it has very little to do with the HTML - do what you want with the HTML.

    A template extracts content from the database into the HTML of your choosing - so basically, make the HTML what you want it - then stick the content where you want it to be, with Template Tags and one The Loop (tm), or multiple loops... or any number of other ways to stuff your HTML full of editable content.

    -I noticed that some themes are "widget-ready" what does that mean? What has to be done to a template to make it "widget-ready"

    Widgets are sidebar toys - they make it easy for people scared to edit their PHP files to use certain plugins and reorder their sidebar. Basically widgets are pointless for someone planning to write their own custom theme for use as a CMS.

    ... unless you intend to package that template for download/use by non-technical folks.

  3. MikeTheVike
    Member
    Posted 4 years ago #

    Thanks for the reply, still trying to understand all this, been using a different cms that doesn't use php, so I'm still in that mindframe.

    Say I have this for my page.php...

    <?php get_header(); ?>
    
    <div id="main">
    	<div id="content">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<?php the_content(); ?>
    		<?php endwhile; endif; ?>
    	</div>
    	<div id="content2">
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<?php the_content(); ?>
    		<?php endwhile; endif; ?>
    	</div>
    	<?php get_sidebar(); ?>
    	<br class="clear" />&nbsp;
    </div>
    
    <?php get_footer(); ?>

    I added that second Loop for testing purposes, learned it just repeats the content twice. At this point how would I get different content in div "content2"?

  4. Ivovic
    Member
    Posted 4 years ago #

    Well, you're off to a good start, but you will definitely need to actually read some documentation to do what you want. The query string can be modified in each of your loops there, to extract pretty much anything you want from the DB.

    The best place to start is the WordPress Codex. Here's the page about The Loop which is what you're working with now.

    You'll also want to check the page on query_posts() linked from there... and get_posts() is a good one too.

    Spend some time in there, look up the functions you see in your other template files and you'll discover some lovely ways to use them to extract data into your own layout.

  5. Ivovic
    Member
    Posted 4 years ago #

    I should point out - this is the hard part, it involves a little bit of a learning curve, and some basic programming skills, but once you've made yourself a template, actually posting content for your site on an ongoing basis will be cake.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.