The Template Tag Reference will help you here. You can do things like the following inside your function to determine the type of page that is being accessed:
if ( bp_is_groups() ) {
// This is the groups page.
}
if ( is_buddypress() ) {
// This is a BuddyPress screen.
}
Thank you very much for the quick reply!
Sorry I am no php pro here, tried like this but breaks page!
add_action( 'wp_head','noindex_groups' );
function noindex_groups() {
if ( bp_is_groups() ) {
echo '<meta name=”robots” content=”noindex, nofollow>'
}
}
add_action( 'wp_head','noindex_buddypress' );
function noindex_buddypress() {
if ( bp_is_groups() ) {
echo '<meta name=”robots” content=”noindex, nofollow>'
}
}
Thanks
I have also tried in a loop like in this codex, but breaking the page, what am i missing?
<?php if ((is_buddypress() ) { echo '<meta name=”robots” content=”noindex, nofollow>'; } ?>
You help is much appreciated!
Thanks
Never mind, forgot the “;” 🙂
Ok for the is_buddypress()
the functions
function for_buddypress() {
if ( is_buddyPress() ) {
echo "<meta name=”robots” content=”noindex, nofollow>";
} else {
}
}
add_action( 'wp_head', 'for_buddypress' );
Working perfectly, but when creating another function for the bp_is_groups()
I am getting error “call to undefined functions bp_is_groups()
Any help is much appreciated!
Thanks