• Hi out there,
    just started with WP and like it, did all the “arounds” of my page which is a full CSS-layout. For the moment, one problem remains while displaying title and content: All my “maincontent”, i.e. all the blog-entrys, is placed in a container with the id=”main”. First, I changed the index,php like this:
    <div id="main">
    <?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
    <h1 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h1>
    <?php the_content(); ?>
    </div>
    However, the html-output is something weird like this:
    <div id="main">
    <h1 id="post-3">titletext</h1>
    text of post 1

    </div>
    <h1 id="post-2">titletext</h1>
    text of post 2


    </div>
    Seems as if there are added additional html-Tags within the php-functions? I tried to find those in some of the php-files but couldn’t find anything. I would like to do the loop within the main div. There are no p-tags in my edited post, and no single or double line breaks.
    Anybody understand the point? Thanks for any hint!
    elya

Viewing 6 replies - 1 through 6 (of 6 total)
  • You dont have to put p-tags in your template, since WP will add those automatically.

    Thread Starter elya

    (@elya)

    Thanks for the answer, but how can I prevent WP from closing the div-tag? I don’t need single posts in div-tags, but the whole content in _one_ div. Which php-function echoes those html-tags?
    elya

    I am not quete following you here. What are you trying to achieve?

    Thread Starter elya

    (@elya)

    I would like a result like this:
    <div id="main">
    <h1>title 1</h1>
    text 1
    <h1>title 2</h2>
    text 2
    </div>
    But my result looks like this:
    <div id="main">
    <h1>title 1</h1>
    text 1
    </div>
    <h1>title 2</h2>
    text 2
    </div>
    I thought I started the loop within the div, but WP closes a div after each post. Why?
    elya

    Just change your CSS, move the divs and use span/header tags for feedback areas etc.
    The result you are seeing is “default” with WP and pretty much every other blog/CMS package. It makes sense since each entry is in it’s own div that can be styled to your liking etc.

    Thread Starter elya

    (@elya)

    OK, seems as if I got it. I’m not used to mix php-code and template-(html-)code, so it was a little bit confusing for me to find tags I can’t see in the template.
    Thanks for your help!
    elya

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘More html-tags in output than in template’ is closed to new replies.