Archive for the ‘Coding’ Category
Make Entrecard and Sociable Valid
I don’t know when it became a habit for me, but I like to make sure my xhtml and css are valid at all times. You can often find Valid XHTML and Valid CSS links across my newer designs (ex: Pieces of Love), and of course, here at this site. As I was validating my site today (instead of studying), I noticed two things that were giving my site errors, and I’ve found ways to correct both of them, so I thought I’d share with you here.
Entrecard is the image link you see on the side bar (conveniently under the heading “entrecard”). The code I used to generate the image was provided by another site, but after checking my site for valid XHTML, I realized that there was a problem with the code. This is the original code: <script src="http://entrecard.s3.amazonaws.com/widget.js?user_id=12580&type=standard_127" type="text/javascript" id="ecard_widget"></script>
The problem likes with the & symbol. Instead, replace that with &, so you get the following code instead:
<script src="http://entrecard.s3.amazonaws.com/widget.js?user_id=12580&type=standard_127" type="text/javascript" id="ecard_widget"></script>
The second thing that was causing trouble was the Sociable (a Wordpress plugin) CSS. The opacity elements were generating errors when I tried to validate my css because they were either browser specific (-moz-opacity) or haven’t been approved as standard css yet. There is a way to use javascript to get around it, but it doesn’t solve the issue of changing opacity on hover. So my solution? Remove the opacity elements altogether, hence why the sociable icons are not semi-transparent.
But is it really necessary to always have valid XHTML and CSS? Some argue yes, some argue no. Read more here:
Valid HTML/XHTML Trend
Validation Alone Isn’t Enough
No Comments » | Wednesday, May 14th, 2008
Sidebar Widgets Show Only On Single Posts/Pages
I was playing around with the Similar Posts Wordpress plugin and I wanted to have it show on the sidebar when it was a single post or page. Now I’ve done something similar before, but it was only to display text:
if (is_single()){
echo "This Entry This is the permanent link for the entry ";
echo the_title();
echo "This post has been filed to ";
UTW_ShowTagsForCurrentPost("commalist");
echo ".";
echo "Related entries:";
UTW_ShowRelatedPostsForCurrentPost("posthtmllist");
echo "
";
}
But the thing was, I had no idea how to do this when I wanted a php code to show up when it was a single post. i knew I’d have to use the is_single() Wordpress conditional tag, but I didn’t know how to implement that with the similar post code:
After playing around with various combinations, this is my working result:
<?php if (is_single()): ?>
<?php similar_posts(); ?>
<? php endif; ?>
Of course, you can replace the is_single() with any other Wordpress conditional tags and replace the <? php similar_posts(); ?> with another php snippet. Just make sure you always add the <? php endif; ?> at the end.
I’m really no expert in php, but this solution worked for me, so if anyone has a better method of getting a php snippet to show up in single Wordpress posts, please share with me! Thanks!
No Comments » | Tuesday, May 13th, 2008
IE Float Drop Bug
Just when I was psyched about making my first layout in css, IE 6 decides to ruin that for me through one of its many css bugs. Now after about 2 days of frantically searching the web and asking in various forums, the problem is FINALLY fixed. The solution? Giving the floating content a negative margin equal to the total width of the content.
#right {
float: left;
width: 566px;
}
* html #right{
display: inline;
margin-right: -596px;
}
Much thanks to Paul D and his comment on this site for the solution.
However, I don’t know if adding this bit of css will break any other browsers, so if any of you notice anything funny about the layout, please let me know.
Also, is anyone interested in link exchanges?
I’m currently in the process of building my links page, so anyone wanting to exchange links, do leave a comment (or contact me)!
3 more days till Thanksgiving break! Woohoo! ![]()
10 Comments » | Sunday, November 19th, 2006
|
























