zen habits: 38 lessons
WordPress + Thickbox Requires Markup
I’ve been fighting with getting the contents of a WordPress page to display within Thickbox.
The great thing about WordPress, is that wiring this up is super straight forward.
- Tell WordPress you want to use thickbox in your theme by adding it to the functions.php file
function init_theme_method() {
add_thickbox();
}
add_action('init', 'init_theme_method');
- Update the paths to the thickbox images (cause WordPress can still get confused about something sometimes)
<script type="text/javascript">
if ( typeof tb_pathToImage != 'string' )
{
var tb_pathToImage = "< ?php echo get_bloginfo('url').'/wp-includes/js/thickbox'; ?>/loadingAnimation.gif";
}
if ( typeof tb_closeImage != 'string' )
{
var tb_closeImage = "< ?php echo get_bloginfo('url').'/wp-includes/js/thickbox'; ?>/tb-close.png";
}
</script>
The I spun up a get_post_content function:
function get_post_content($post_id) {
global $wpdb;
$data = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ID=$post_id");
return $data[0]->post_content;
}
and added it as a hidden div in my footer.php
<div id="about" style="display:none;">
<?php echo get_post_content($id); } ?>
</div>
and created a link to launch the thickbox <a href="#TB_Inline?inlineId=about" class="thickbox"</a>
But it was blank.
Empty.
Nothing in the box.
Turns out thickbox requires some markup – any markup – within the requested inlineId.
<div id="about" style="display:none;">
<p><?php echo get_post_content($id); } ?></p>
</div>
In Praise of Hopville’s Beer Calculus
Tonight, I loaded my beer recipes into Hopville’s Beer Calculus (thanks to Mr. Hadden for the tip).
Yes, they’re all off style. Some by a little, and some so off – they’re on (the Maibock passed BJCP guidelines for American Barleywine).
In all honesty – this round of brewing wasn’t about hitting a style, it was about the confidence of building a recipe. And, turns out, becoming fixated on making the recipe better.
There’s a lesson in here about being ready for new tools & insights. The first time I read Hitchhikers – it was complete jibberish. Three months ago, Beer Calculus would have been as well.
Where I really see Hopville’s Beer Calculus excelling is in setting up the bounds for a style and helping me find my target within there.
Easily, the best homebrew resource yet.
With Basic Brewing Radio & The Mad Fermentationist coming in a close second.
I just had a long, difficult conversation with the Out Like a Lion. We both agree that things have to change, no one’s at fault, and we’ll both try harder next time.
Tracking Flash Movie Plays with Google Analytics
If you’re looking for a quick way to track when Flash movies (or anything else in <object> <embed> tags) are played – this works for me:
Quick overview: create a new div
with an onClick action and put the Flash movie inside it.
Then in the movie’s <object>
tag – add <param name="wmode" value="transparent" />
and in the <embed> tag add this attribute wmode="transparent"
The wmode
declarations allow the click in the Flash movie to pass through to the enclosing div
and trigger the onClick.
Like this:
<div onClick="_gaq.push(['_trackEvent', 'Videos', 'MovieName', 'PageName']);">
<object...>
<param name="movie" value="http://path.to.swf" />
...
<param name="wmode" value="transparent" />
<embed wmode="transparent" ..." />
</object>
</div>
Where You Going?
EFF: Why We Need An Open Wireless Movement
As you know – I’ve got a long bet on WiFi being the default transport for all our information exchange; voice, video, audio, email, web, everything. Everything.
Unfortunately – there’s an insidious group with a counter bet and planting FUD everywhere.
Thankfully, the EFF has declared the need and benefit for more open WiFi networks:
BTW – here’s my rule of thumb on protecting WiFi networks:
Don’t – it will inconvenience and irritate those you want to have access far more than those you don’t.
Me-tered
Link Rot
“The idea that authority is best transmitted by a coarse-grained gesture like linking is bankrupted by the sheer volume of gaming that is emerging.” – Steve Gillmor
Back in the early days of Cullect – I was trying to figure out a way to programmatically provide a meaningful excerpt of an article. In the end – I decided that any solution would just be trying to guess which words and phrases were meaningful to any given reader. It’s easier to not guess – and our brains are really good at scanning for interestingness. So, to give your internal scanning as much info as possible – Cullect displayed everything it could.
It feels like more publications are showing less; headline, link, maybe an 1 sentence excerpt. Twitter & Delicious being the worst offenders. Facebook, Pinboard, and other publishers (traditional & otherwise) are fast followers.
I’d like to see more publishers display more by default – not less. Most of them are already making editorial decisions on placement – let’s go all the way. If this really is the most important story of right now – why are any other stories even visible?
tl;dl
like tl;dr but for talking.