Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts

    How to make the text stay in 1 row only

    Hello, I think this questions is more related to CSS/HTML than to PHP.

    Please take a look here.

    As you can see in the post, at the very top there is something like:
    Code:
    sie - 09 | Napisała: glamourina | 2 comments.	i
    4
    komentarze z Facebook'a
    I would like to appear like this:
    Code:
    sie - 09 | Napisała: glamourina | 2 comments.	i 4 komentarze z Facebook'a
    .

    The code is the following:
    PHP Code:
    <div class="post_date">

    <?php the_time('M'?> - <?php the_time('d'?> | <?php _e("Posted by: ","language")?> <?php the_author_posts_link(); ?> | <a href="<?php comments_link(); ?>"><?php comments_number('no comments','one comment','% comments'); ?>.</a>    i <a href="<?php comments_link(); ?>"><div class="fb-comments-count" data-href="<?php echo get_permalink($post->ID); ?>">0</div> komentarze z Facebook'a</a>                           

    </div>
    Please help me to make all this code in one line, I'm getting crazy, there are no <br> anywhere

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,854
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Code:
    <a href="<?php comments_link(); ?>"><div class="fb-comments-count" data-href="<?php echo get_permalink($post->ID); ?>">0</div> komentarze z Facebook'a</a>
    Change that <div> to <span>.

    PS: Nesting a block level element like <div> inside an inline element like <a> is in fact invalid.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    utnalove (08-10-2012)

  • #3
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts
    Thanks. The good thing is that it is now in one line.
    The bad thing is that the facebook function is not working anymore and instead of 4 comments it's showing 0.

    Btw. I found that code here.
    I've also found this code that may help, but probably it does not.
    Last edited by utnalove; 08-10-2012 at 10:58 AM.

  • #4
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 Posts
    Quote Originally Posted by utnalove View Post
    The bad thing is that the facebook function is not working anymore and instead of 4 comments it's showing 0.
    The Facebook API probably requires that the element be a div element. You can use a div element and style it with display: inline to be rid of the line-breaking behavior:

    Code:
    .fb-comments-count { display: inline; }
    abduraooft was correct in noting that your code was invalid. div elements are disallowed within a elements in XHTML 1.0 Transitional.

    That restriction has since been removed in HTML5, however. You may want to consider switching to that from XHTML 1.0 Transitional. Your document has a number of other errors that can also be remedied with such a change, including use of the document.write method (which is disallowed in XHTML) and data-* attributes (used by the Facebook API).
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • Users who have thanked Arbitrator for this post:

    utnalove (08-10-2012)

  • #5
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts
    Thank you so much! It is now working with the following code:

    PHP Code:
    <?php the_time('M'?> - <?php the_time('d'?> | 
    <?php _e("Posted by: ","language")?> <?php the_author_posts_link(); ?> | 
    <a href="<?php comments_link(); ?>"><?php comments_number('no comments','one comment','% comments'); ?>.</a>

    i <a href="<?php comments_link(); ?>"><div class="fb-comments-count" style="display: inline" data-href="<?php echo get_permalink($post->ID); ?>">0</div> komentarze z Facebook'a</a>
    So this code above is HTML5 valid, but XHTML invalid?
    For me it is important for it to be HTML5 valid, because in few weeks I am going to have somebody to convert the full site to HTML5.

  • #6
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 Posts
    Quote Originally Posted by utnalove View Post
    So this code above is HTML5 valid, but XHTML invalid?
    That's actually PHP, but, yes, the expected output would be valid HTML5 and invalid XHTML 1.0.

    That data-href (data-*) attribute used by your Facebook code is derived from HTML5 and is the reason—other than the div issue—as to why that portion of the code is invalid XHTML 1.0.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • Users who have thanked Arbitrator for this post:

    utnalove (08-10-2012)

  • #7
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts
    Thank you for the explanation. I hope html5 and the w3c validation will also help in seo terms ^_^

  • #8
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts
    Maybe you are interested in it or you know... I have asked a related question here ... now I would like to merge the two counts.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •