• Hello

    I have this question, i would like to add some html after first post and before third post , is there a easy solution to make it happend ?

Viewing 15 replies - 1 through 15 (of 29 total)
  • Yes…almost. This will show something after the first post but before the second post.

    <?php <-----------ADD THIS SECTION
    $postnum = 1;
    $addmyhtml = 1;
    ?> <-----------
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    The bottom line there is for reference.

    Next, add this:

    <?php if ($postnum == $addmyhtml) {
    echo 'ADD YOUR CONTENT HERE';
    } ?>
    <?php $addmyhtml++; ?>
    <?php endwhile; else: ?>
    <——-for reference

    If you want it after the second post, make addmyhtml=2

    That help at all ?

    Thread Starter piotr82

    (@piotr82)

    Ok i will test it now.
    I wrote if this is ok.

    Thread Starter piotr82

    (@piotr82)

    Well, where i should add this php that you wrote,
    if you could check , this is my page http://www.guistyles.com
    i would like to add after first post the post that is at low of this page, support links

    in which php file i should add this , in index.php ?

    Yes, it most likely goes in index.php.

    Additional info:Template_Hierarchy

    Thread Starter piotr82

    (@piotr82)

    well when i add this to index.php i try in several places it demage the page, show that this is error 🙁

    probably i don’t know where to add this

    Podz has you putting in two chunks of code there, one before the <?php if (have_posts()) : ... code and the other chunk goes after <?php if (have_posts()) : ...

    If you can’t figure it out you may have to post your index.php at http://pastebin.com/ and report back that link so we can look at the problem.

    Thread Starter piotr82

    (@piotr82)

    Thread Starter piotr82

    (@piotr82)

    ok

    <?php
    $postnum = 1;
    $addmyhtml = 1;
    ?>

    <?php if (have_posts()) : ?>

    <?php if ($postnum == $addmyhtml) {
    echo ‘ADD YOUR CONTENT HERE’;
    } ?>
    <?php $addmyhtml=2; ?>
    <?php endwhile; else: ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class=”post”>

    and
    Parse error: parse error, unexpected T_ENDWHILE in /homeg/informatyka/2001/ID/s/slabosz/public_html/wordpress/wp-content/themes/aquasoft/index.php on line 50

    line 50 is :

    <?php endwhile; else: ?>

    1. Obviously you didn’t read carefully what Podz posted. In between the two code snippet there should be the rest of The_Loop.
    2. MichaelH asked you to post the code at http://pastebin.com – se that we can go there and edit it to help you.

    Thread Starter piotr82

    (@piotr82)

    UuUps , sorry , i don’t know php 🙁

    http://pastebin.com/466659

    ready

    Try this: http://pastebin.com/466666
    Not guaranted but it might work.
    Where it says: ADD YOUR CONTENT HERE – write your text.

    Thread Starter piotr82

    (@piotr82)

    Well it work , but not when i add my content :

    <div class=”heading” Sponsored links </div>
    <small>December 15rd, 2005 , 3:27 pm

    Pass 2 minute ago
    </small>

    google ads

    Thread Starter piotr82

    (@piotr82)

    Got this :

    Parse error: parse error, unexpected ‘<‘ in /homeg/informatyka/2001/ID/s/slabosz/public_html/wordpress/wp-content/themes/aquasoft/index.php on line 93

    Thread Starter piotr82

    (@piotr82)

    hmm and what no response, i get this error with adding my contest , maybe you could say why it won’t start and i get this parse error, when i use echo test it works

    Well, some people are in a totally different time zone at the other end of the world… If it works properly just echoing a test text – it means there is something wrong with the code you put in.

Viewing 15 replies - 1 through 15 (of 29 total)

The topic ‘Add something after first post’ is closed to new replies.