• Resolved venkman

    (@venkman)


    hello there, have a look here please…

    even with no css styles at all if i have the the code:

    <div class="post" id="post-<?php the_ID(); ?>">
    	 <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?><?php the_date('','<h2>','</h2>'); ?></a></h3>

    the date only goes after the story title – not on the same line. so if i put the date and time – which i take it is the code inclusnd the <?php ?> brackets:

    <?php the_date('','<h2>','</h2>'); ?>

    before the h3 tag, in the link or after the < a > link it gos on a new line.

    i don’t understand how there is any formatting on there (the date became blue when placed within the < a > tag which makes sense, but from where is it getting the idea to start a new line? and also where does the default formatting come from?

    i have a fair idea of css and html bu perhaps im missing something in using the php here.. please have a look and see if you can help. thanks very much.

    venk.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Are you expecting block-level elements to share a line or am I misreading this?

    If you create a basic HTML page with something like:
    <h2>h2 test></h2> <h3>h3 test</h3>
    and no specific CSS, they’re on two lines, right?

    Thread Starter venkman

    (@venkman)

    yeah that’s the stuff. so each ‘h’ tag makes the text a different size and each time you change between them it puts a new line right:

    so how come if i have the date and the title on the same line in the code and only use the one ‘h3’ tag for that line it still places the date and time on two different lines?

    <div class="post" id="post-<?php the_ID(); ?>">
    	 <h3 class="storytitle"><?php the_date('','',''); ?>help<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>

    i added the word ‘help’ in there to test if ordinary text is affected but it’s on the correct lne – just before the title. like i say, the date is on the line above. how can i get it on the same line?

    i guess this might need a simple coding fix?

    thanks for looking!

    The lightbulb goes on.

    To make sure I’m following: In that example, you get two lines? The opening <h3> on one line and the closing </h3> on the line below?

    Thread Starter venkman

    (@venkman)

    in the example:

    <div class="post" id="post-<?php the_ID(); ?>">
    	 <h3 class="storytitle"><?php the_date('','',''); ?>help<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>

    when i upload the page, in my browser the date and title appear on different lines. take a peep:
    http://img81.imageshack.us/img81/5455/dateandtimewf8.png

    maybe if i take off all the < h > tags..

    Thread Starter venkman

    (@venkman)

    nope, even if the code is:

    div class="post" id="post-<?php the_ID(); ?>">
    	 <?php the_date('','',''); ?>help<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>

    it’s still on a separate line !

    Thread Starter venkman

    (@venkman)

    why is this?

    Sorry, been rather swamped by real life. I’d be curious to see the HTML generated by your most previous example.

    How wide is the div that your trying to fit this in?

    If your div is only 200px wide, and the output of your date code is 250px it is going to wrap.

    Just a guess, its hard to figure out without being able to see the page itself.

    If this is all about the URL in your profile, then either it’s fixed, or it’s not an issue for firefox.

    Thread Starter venkman

    (@venkman)

    🙂 haha yeah real life can do that.. thanks so much for having a look at this people, it helps – you know?

    so i changed the code to

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <?php the_date(); ?><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>yes
    <div class="post" id="post-<?php the_ID(); ?>">

    and got it to go onto the same line. the main thing i did there was to get rid of ”,”,” from in the brackets there.

    <?php the_date('','',''); ?>

    is now

    <?php the_date(); ?>

    i bet that was so simple / obvious you all decided not to mention it. i knew it had to be one of the php elements, i really am not sure what can go in the php brackets, and am learning when wordpress loads defaults etc : or when it’s just html formatting i missed in there.

    all fun, thanks again. i’m sure i’ll have more questions.

    until then –> back to the real world.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘date and time on the same line’ is closed to new replies.