WordPress plugin for Pinboard theme and Secondary HTML Content plugin

So, I’ve noticed that when you try to combine the Secondary HTML Content plugin with the Pinboard theme from WordPress, there’s a couple of issue to note. This might actually work for all of the themes out there. The problem I was having was that I wanted two pieces of content. That’s fine. The Secondary HTML Content plugin would take care of that in the regular theme. When I added the Pinboard theme from WordPress because I thought it was so awesome, the secondary content widgets disappeared. Sure, I could have modified the theme, or dig in the plugin and update it… but why? Updating those would overwrite my work anyway. So… I came up with this solution after reading about adding and removing filters and actions.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
function okmAddingContentExcerpt() {
    global $post;
    $content = '<div class="comment-first">'.$post->post_content.'</div>';
    $content .= '<div class="comment-second">'.get_secondary_content('Adia Review',$post->ID).'</div>';
    return $content;
}
add_filter('the_excerpt', 'okmAddingContentExcerpt');

function okmAddingContentSingle() {
    global $post;
    $content = '<div class="comment-first">'.$post->post_content.'</div>';
    // remove the filter so that it doesn't loop over and over
    remove_filter('the_content','okmAddingContentSingle');
    $content .= '<div class="comment-second">'.get_secondary_content('Adia Review',$post->ID).'</div>';
    return $content;
}
add_filter('the_content', 'okmAddingContentSingle');
?>

Here it is as a download:

moviemakers

Wonder why I called it moviemakers? You’ll have to wait until the website is done. 😉