I'm trying to attach a div from a voting plugin before the content is generated on both the e开发者_如何转开发xcerpt and the content of a post. Here's what I have in my plugin:
if (get_option('ilt_onPage') == '1') {
function putILikeThis($content) {
if(!is_feed() && !is_single() && !in_category('3') ) {
$likethisbox.= getILikeThis('put');
}
$content = $likethisbox . $content;
return $content;
}
add_filter('the_content', putILikeThis);
}
if (get_option('ilt_onPage') == '1') {
function putILikeThis1($excerpt) {
if(!is_feed() && !is_archive() && in_category('3') ) {
$likethisbox.= getILikeThis('put');
}
$excerpt = $likethisbox . $excerpt;
return $excerpt;
}
add_filter('the_excerpt', putILikeThis1);
}
Any ideas on what I'm doing wrong?
Figured it out. Several key things were going wrong. Code I used here:
if (get_option('ilt_onPage') == '1') {
function putILikeThis($content) {
if(!is_feed() && !is_page() && in_category('revocations') ) { //it now sees the category!
$likethisbox= getILikeThis('put'); //No .= period behind the =
}
return $likethisbox . $content; //I was putting these into a $ when needed to return them
}
add_filter('the_content', 'putILikeThis'); }
精彩评论