• I have just started fiddling with wordpress – used it once before and didn’t mind it but jumped back on the joomla wagon.

    After 3.0 and the ability to multi-site I am back. I have slaved away learning to template in my spare time this week and have scoured the internet for tutorials. I have managed to make an index.php and front-page.php template using a tutorial I have found and everything looks good – so far.

    Now it’s time to add content and I’m at a road block, had to restart my computer to install some updates and sure enough forgot to bookmark the tutorial I was using (I ran out of coffee, leave me alone haha).

    Anyways I am trying to add content to my front-page.php and I have my code laid out as such:

    <html>
    <body>
    	<div id="mainbox">
    		<div id="topspace">&nbsp;</div>
    		<div id="greybox">
    			<div id="picturespacetop">
    				<?php get_header(); ?>
    			</div>
    
    			<div id="picturebox"></div>
    
    			<div id="picturespacebottom">
    				<?php get_sidebar(); ?>
    			</div>
    		</div>
    
    <strong>	<div id="content">
    			This is where my content should be!
    		</div></strong>
    
    		<div id="footer">
    			<?php get_footer(); ?>
    		</div>
    	</div>
    </body>
    </html>

    Of course my content I don’t have anything under my content div….I know the answer is probably on these forums somewhere(I will look high and low tomorrow, for tonight google has failed me). In theory what I would love to do is make a page (let’s call it index) in my dashboard; then insert whatever content is on that index page in my dashboard into front-page.php. I don’t want posts – I don’t want users to be able to comment. My goal is that the front page will have a short and sweet blurb on my site (more of a CMS type setup), and users can comment on posts on other pages of my site.

    Thank you if you go easy on me by giving me the answer, otherwise, thank you for just reading.

Viewing 1 replies (of 1 total)
  • Technically, you could hard-code the content in HTML, but that would pretty much defeat the purpose of WordPress, wouldn’t it?

    A better option would be to make a WordPress page, and then set up your file as a custom template specifically for that page. The key ingredients are the template tag at the top of the page and the Loop. So, a very simple custom page template might look like this:

    <?php
    /* Template Name: Custom template
     */
    
    get_header(); ?>
    <div id="content">
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <!-- your formatting of the post content goes here, perhaps something like this: -->
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
       <h1 class="entry-title"><?php the_title(); ?></h1>
       <div class="entry-content">
          <?php the_content(); ?>
       </div><!-- .entry-content -->
    </div><!-- #post-## -->
    <?php endwhile; ?>
    </div><!-- #content -->
    <?php get_sidebar; /* (if you have a sidebar) */ ?>
    <?php get_footer; ?>

    When you are editing the page in your admin panel, there is an option on the right side to select the template that you are going to use for that page. That is where you would want to select “Custom template”.

    A few other things of note…. While technically you can write your header and footer however you want, a good practice is to contain all the opening code in your header, and all the closing code in the footer, rather than manually coding them in each template file.

    Some good resources:
    The_Loop
    Theme_Development
    Templates

Viewing 1 replies (of 1 total)

The topic ‘Newbie question – content’ is closed to new replies.