How to put ONLY the posts in my already existing layout?
-
I just installed WP, and I can’t put only the posts in my layout…. I already tried, but failed….. Can it be that hard??? =( Please, help me……
-
Uhm, what do you mean?
I believe it’s the same problem I’m having… I’ve just installed WP 1.5 and I’m not interested in using or creating WP templates, I’d like to use a layout I created myself to show up my entries.
The question is if it’s possible to adapt a simple layout to show the posts, by just including the loop and necessary tags (author, comment, content tags)… I was able to do so in an older version, but the coding I used didn’t work with version 1.5.
Or do we necessary need to create a whole WP template (in wp-content) in order to change the weblog look??
Queen, just add the Loop to your layout
Maryafernanda, The Loop has changed in WP v1.5.
Searching the forum I was able to find the new loop, but my weblog still doesn’t load. I looked at my old <*head> and I used to include
<?php wp_get_archives(‘type=monthly&format=link’); ?>
<?php wp_head(); ?>in it, but apparently these lines are no longer accepted… what are the new ones then?
Thanks.
Read this please: http://codex.wordpress.org/The_Loop
I’ve already read about the loop, and according to that page, all you need is to add in the beginnning of index.php
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
and in the end
<?php endwhile; else: ?>
<?php _e(‘Sorry, no posts matched your criteria.’); ?>
<?php endif; ?>but my blog refuses to load with only these 2 tags, there must be something missing. I tried once to include from a older version
<?php require(‘./wp-blog-header.php’); ?>
before <*head>, and the blog itself loeded, but then I could not load my comments.
You’re missing a critical part.
The loop starts here:
<?php if ( have_posts() )Â : while ( have_posts() )Â : the_post();Â ?>
and ends here:
<?php endwhile; else:Â ?>
<p><?php _e('Sorry, no posts matched your criteria.');Â ?></p>
<?php endif;Â ?>You need to include everything in between as well.
I’m aware there’s information between these 2 lines. My index looks like this:
<? include(“/home/mfpina/public_html/header.php”); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_date(”,'<div class=”data”>’,'</div>’); ?>
<br>
<div class=”title”><?php the_title(); ?></div>
<?php the_content(__(‘(more…)’)); ?>
<div class=”comment”>
Marya @ <?php the_time() ?> |
<?php wp_link_pages(); ?>
<?php comments_popup_link(__(‘Comentar? (0)’), __(‘Comentário (1)’), __(‘Comentários (%)’)); ?><br>
<div class=”meta”><?php _e(“Categoria:”); ?> <?php the_category(‘,’) ?></div>
</div><br><br>
<?php endwhile; else: ?>
<?php _e(‘Sorry, no posts matched your criteria.’); ?>
<?php endif; ?><?php posts_nav_link(‘ — ‘, __(‘« Página anterior’), __(‘Próxima Página »’)); ?>
<? include(“/home/mfpina/public_html/footer.php”); ?>
The loop is there and, still, it doesn’t load.
Hey,
What error do you get? Or do you just get a blank page? Reading your first post, you need to create a new template (or more correctly, theme: which is simply a subdirectory inside wp-content/themes/ where the templates and CSS lives) inside the wp-content directory should you want to have your own design unless you edit one of the original templates.
Nonetheless, all template data has to be in a subdirectory of wp-content/themes, and then that theme has to be activated (using the control panel).
Sorry if you already knew that but I wasn’t sure.
Rob
- The topic ‘How to put ONLY the posts in my already existing layout?’ is closed to new replies.