BlueDot Auto-Blog Fix for WordPress
I recently started using BlueDot’s Auto-Blog feature. It’s a nifty little tool that takes the Dots I’ve chosen (through tag filtering) and auto-posts them each night. However, I noticed that these posts were wreaking havoc on my WordPress theme(s). After quite a bit of tinkering with the code, I thought I had fixed it. Alas, it seemed like there was no pattern to the madness.
It finally dawned on me that it was not something inherently wrong with the code in the post, but because I was omitting information when I dotted a page. If I didn’t enter in a note for the Dot, the page would break. Well, I don’t want to necessarily have to enter in a note for every Dot I make, so I came up with a fix.
The fine folks over at BlueDot saw my post (auto-dotted from my blog) and made a very quick update to their auto-blogging code. This instructions in the following post should no longer be necessary. Thanks mohit!
You need to change two files in your WordPress theme:
- index.php
- single.php
In index.php, find the following section of code:
<div class="entry">
<?php the_content('Continue reading &raquo;'); ?>
</div>
Replace it with this:
<?php
$cat = get_the_category();
$cat = $cat[0];
$catname = $cat->cat_name;
// Grab the category name for the upcoming post
?>
<div class="entry">
<?php the_content('Continue reading &raquo;'); ?>
<?php
if ($catname == "BlueDot"){
preg_match_all("/<div class=\"bluedotNote\" \/>/m", get_the_content(), $matches);
for ($counter = 1; $counter <= sizeof($matches[0]); $counter++){
echo "</div><!-- Missing /div from bluedotNote -->";
}
}
?>
</div>
In single.php, find the following section of code:
<div class="entry">
<?php the_content('<p class="serif">Continue reading &raquo;</p>'); ?>
Replace it with this:
<?php
$cat = get_the_category();
$cat = $cat[0];
$catname = $cat->cat_name;
// Grab the category name for the upcoming post
?>
<div class="entry">
<?php the_content('<p class="serif">Continue reading &raquo;</p>'); ?>
<?php
if ($catname == "BlueDot"){
preg_match_all("/<div class=\"bluedotNote\" \/>/m", get_the_content(), $matches);
for ($counter = 1; $counter <= sizeof($matches[0]); $counter++){
echo "</div><!-- Missing /div from bluedotNote -->";
}
}
?>
Essentially, we grab the category for the entry (all my BlueDot entries are posted with a category of “BlueDot”) and check to see if we have a BlueDot post. If so, we search the post for an instance of:
<div class="bluedotNote" />
This indicates a Dot that is missing a note. If this snippet is found, the code adds an extra closing div tag in order to compensate.
This code also works with multiple Dots per entry.

Leave a Reply