WordPress.org

Ready to get started?Download WordPress

Forums

How to put ONLY the posts in my already existing layout? (10 posts)

  1. queen
    Member
    Posted 9 years ago #

    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......

  2. eridan
    Member
    Posted 9 years ago #

    Uhm, what do you mean?

  3. maryafernanda
    Member
    Posted 9 years ago #

    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??

  4. Queen, just add the Loop to your layout

    Maryafernanda, The Loop has changed in WP v1.5.

    http://codex.wordpress.org/The_Loop

  5. maryafernanda
    Member
    Posted 9 years ago #

    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.

  6. maryafernanda
    Member
    Posted 9 years ago #

    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.

  7. 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.

  8. maryafernanda
    Member
    Posted 9 years ago #

    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.

  9. rwatkins
    Member
    Posted 9 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.