...

View Full Version : How to make the text stay in 1 row only



utnalove
08-10-2012, 10:32 AM
Hello, I think this questions is more related to CSS/HTML than to PHP.

Please take a look here (http://glamourina.pl/obciach-po-polsku-i-jedziesz).

As you can see in the post, at the very top there is something like:

sie - 09 | Napisała: glamourina | 2 comments. i
4
komentarze z Facebook'a

I would like to appear like this:

sie - 09 | Napisała: glamourina | 2 comments. i 4 komentarze z Facebook'a.

The code is the following:

<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 :(

abduraooft
08-10-2012, 10:37 AM
<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.

utnalove
08-10-2012, 10:40 AM
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 (http://stackoverflow.com/questions/7642631/how-to-get-facebook-comments-count-with-html5).
I've also found this (http://stackoverflow.com/questions/8693626/how-to-get-facebook-comments-count-in-html5-without-using-a-div)code that may help, but probably it does not.

Arbitrator
08-10-2012, 11:18 AM
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:


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

utnalove
08-10-2012, 11:24 AM
Thank you so much! It is now working with the following 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.

Arbitrator
08-10-2012, 11:56 AM
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.

utnalove
08-10-2012, 12:00 PM
Thank you for the explanation. I hope html5 and the w3c validation will also help in seo terms ^_^

utnalove
08-10-2012, 04:47 PM
Maybe you are interested in it or you know... I have asked a related question here (http://www.codingforums.com/showthread.php?t=270193) ... now I would like to merge the two counts.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum