Hi there.
I'm trying to modify a "thematic_create_robots" filter and it's not going well.
Any help would be greatly appreciated.
I would like to make http://example.com/page/2 and all those paged URLs have a "noindex,follow" robots meta tag, basically, the entire /page/ dir.
I tried messing around with the ((is_home() && ($paged < 2 )) bits, and it's not working, probably because I'm not very good with php.
Do I need to create another elseif statement, and how?
I don't have any SEO plugins installed, and would like to do this with the filter.
Here's what I have in functions.php for your reference. Thanks in advance.
function childtheme_create_robots() {
if((is_home() && ($paged < 2 )) || is_front_page() || is_single() || is_attachment()) {
$content .= "<meta name=\"robots\" content=\"index,follow\" />";
} elseif (is_search()) {
$content .= "<meta name=\"robots\" content=\"noindex,nofollow\" />";
}
/*
elseif (is_page('about-me') {
$content .= "<meta name=\"robots\" content=\"noindex,follow\" />";
}
*/
else {
$content .= "<meta name=\"robots\" content=\"noindex,follow\" />";
}
return $content;
}
add_filter('thematic_create_robots', 'childtheme_create_robots');
With the above, I get "index,follow" for everything in /paged/