Issues with Podtrac and Podpress in Wordpress

August 7th, 2008 Mark

Saw a lot of possible fixes for this issue. The problem is in the General Settings of Podpress, when enabling Podtrac statistics nothing changes with the MP3 urls in the feed. All you have to do is format your uploads folder field named “URI of media files directory” like this:

http://www.podtrac.com/pts/redirect.mp3/www.YOURDOMAINNAME.com/wp-content/uploads

This is assuming you already have an account set up wih Podtrac.

document.getElementById null error

July 30th, 2008 Mark

If you keep getting this error it is because the element ID truly is null.  But you say “But it’s write here on the page with a DIV id on it!”? Well you’re probably doing what I did - calling the getElementById before the DIV exists in the normal flow of the page. Put your call in a function call after the DIV on the page (not in the page header) and the issue goes away.

WP_Query issues with sortby

May 2nd, 2008 Mark

Was trying to figure out the proper way to sort my WP_Query post results by category and found out that there are some buggy things with the sortby using WP_Query. I wanted to sort by cat_name then tried cat_id and cat_nicename. All work for the most part but would throw a post randomly out of order. So I ended up stacking my results into an object array and using the trusty PHP “sort”. Like this:

class an_object {
var $an_name;
var $an_slug;
}

$i=0;
$my_query = new WP_Query();
while ($my_query->have_posts()) : $my_query->the_post();
$an[$i] = new an_object();
foreach((get_the_category()) as $category) {
$an[$i]->an_slug = $category->category_nicename;
$an[$i]->an_name = $category->cat_name;
}
$i++;
endwhile;

sort($an);

$z=0;
while($an[$z]){
echo $an[$z]->an_name.” “.$an[$z]->an_slug.”<br />”;

$z++;
}