Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter joah

    (@joah)

    Maybe I should make my question more specific:
    I have built the basic structure of my index page, which will contain “the loop”. I’m just starting to grasp the loop concept, but i’m unclear on the following:

    In the default theme, a call to the sidebar is made after the loop, right before calling the footer. I think my index file has the call to the sidebar inside the loop (but i’m not sure). Is this going to be a problem??

    <body>
    	<div id="page">
        	<div id="header">
                	<a href="<?php echo get_option('home'); ?>/"><img id="headerimage" src="/wp-content/themes/redout/images/redout_logo.png"/></a>
            </div>
    <?php /*?>header end<?php */?>
    
    <?php /*?>index start<?php */?>
          <div id="container">
                <div id="content">
                    content                  <==== DOES THE LOOP GO HERE?
                </div>
                <div id="leftcol">
    <?php /*?>sidebar start<?php */?>
                 	sidebar                   <=== I PLANNED THE SIDEBAR HERE
    <?php /*?>sidebar end<?php */?>
                </div>
                <div id="rightcol">
                    rightcol
                </div>
          </div>
    <?php /*?>index end<?php */?>
    
    <?php /*?>footer start<?php */?>
            <div id="footer">
                footer
            </div>
        </div>
    </body>
    </html>
    <?php /*?>footer end<?php */?>

    That’s not going to work in in index.php at all. You have to learn more about converting HTML to WordPress theme.

    Another way to learn is by looking at codes of other WordPress themes and then apply your HTML markups there. I looked for a WordPress theme that’s relatively simple for your edification – https://www.ads-software.com/extend/themes/bytetips. Another much simpler theme to study is the Classic theme that’s included in basic upload of WP.

    Thread Starter joah

    (@joah)

    The above code is not yet split into seperate header, footer, sidebar and index files. I thought i’d get the page to work as a whole first, and then split it into its template parts.

    Also, I have not yet added all the php-code that WordPress uses. I’m just trying to figure out what goes where in CSS.

    I hope this clarifies the question I’m asking, but perhaps your answer still remains the same. I’m going to take a look at the templates you mentioned now…

    In the meantime, if anyone has something to add, please do so. ??

    Thread Starter joah

    (@joah)

    allright,

    I updated the code a bit… (?) :

    <body>
    	<div id="page">
        	<div id="header">
                	<a href="<?php echo get_option('home'); ?>/"><img id="headerimage" src="/wp-content/themes/redout/images/redout_logo.png"/></a>
            </div>
    <!-- header end -->
    
    <!-- index start -->
          <div id="container">
                <div id="content">
    
                 <!-- loop start -->
                 	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                    <a href="<?php the_permalink() ?>" rel="bookmark" title='Click to read: "<?php strip_tags(the_title()); ?>"'><?php the_title(); ?></a>
                    <?php the_content("Continue reading '" . the_title('', '', false) . "'"); ?>
                    <?php endwhile; ?>
                    <?php next_posts_link('&laquo; Older blog posts') ?> <?php previous_posts_link('&bull; Newer blog posts &raquo;') ?>
                    <?php else : ?>
     		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.
    		?php include (TEMPLATEPATH . "/searchform.php"); ?>
    		<?php endif; ?>
                 <!-- loop end -->   
    
                </div>
                <div id="leftcol">
    <!-- index end -->
                 	sidebar
    <!-- sidebar start -->
                </div>
                <div id="rightcol">
                    rightcol
                </div>
          </div>
    <!-- sidebar end -->
    
    <!-- footer start -->
            <div id="footer">
                footer
            </div>
        </div>
    </body>
    </html>
    <!-- footer end -->

    So far, it seems to be working, and the loop is generating posts as can be seen here at my URL. I think I’m on the right track, but i’m still very weary about any mistakes i might be making, that should be recognized now, before i’m too far into the development.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Code-Newbie Needs Pointers’ is closed to new replies.