Wednesday, June 30, 2010

Mobile Safari CSS3 / JS

Hey Guys,

Just wanted to point something that I tried out with some good success.

Mobile Safari supports multiple background images.

I kind of wondered when I would get around to actually wanting them, but then it came up in this project I was doing that involved creating a sortable table. I have an up arrow and a down arrow and want them to both appear on an unsorted table and then for only one to appear once the table has been sorted. I am using JQuery tablesorter for my sorting by the way, which works great on mobile. This is a mobile web app that supports the "web clip" option for saving to the mobile desktop, which means everything is loaded through ajax. Anyway, here is some code showing how this works and why it's userful.

#list table thead th {
 background-color: #777;
 background-image: url('images/up.png'), url('images/down.png');
 background-repeat: no-repeat, no-repeat;
 background-position: 98% 33%, 98% 66%;
 width: 50%;
 text-align: left;
 padding: 8px 20px 8px 8px;
 color: #ccc;
 font-size: 11px;

#list table thead th.headerSortDown {
 background: #777 url('images/down.png') no-repeat 98% 50%;

#list table thead th.headerSortUp {
 background: #777 url('images/up.png') no-repeat 98% 50%;

JQuery Tablesorter Plugin
CSS3 Multiple Background images

Monday, June 21, 2010

Command-line Coda

After trying to open a hard to find file from the Coda file browser, I decided to use the command line. This little program makes that possible!

Tuesday, June 15, 2010

Wordpress Custom Shortcodes

I have been playing with Wordpress custom shortcodes for a template we're building here at work. Unfortunately I was having some problems getting the shortcodes to be parsed. I found out the problem in the comments of the smashing magazine article below.

SHORTCODES are only parsed when using the_content() to display the page data.

This was a problem as I was pulling the page data into a variable and then echoing $page->post_content. No worries. Once I added the loop code around the page
if (have_posts()) : while (have_posts()) : the_post();
endwhile; endif;
the_content() AND my short codes worked fine!

Hurray! Wordpress can be a pain, but this was easy!


Wednesday, June 9, 2010

Conditional Wordpress Navigation

Hey guys,

This is the way to do it. I figured it out by looking in /wp-includes/link-template.php.

<?php if ($prevPostsLink = get_next_posts_link("Previous")):?>
<li class='active'><?php echo $prevPostsLink;?></li>
<?php else:?>
<li class=''><a href="#" onclick="return false;" class="prev">Previous</a></li>
<?php endif?>
<?php if ($nextPostsLink = get_previous_posts_link("Next")): ?>
<li class='active'><?php echo $nextPostsLink;?></li>
<?php else:?>
<li class=''><a href="#" onclick="return false;" class="next">Next</a></li>
<?php endif?>

None of the following worked for me: