Info
- 10 posts
- 4 voices
- Started 4 years ago by intellivision
- Latest reply from Olaf
- This topic is not resolved
Keep spiders out of forum categories?
-
- Posted 4 years ago #
How to do this?
-
- Posted 4 years ago #
What forum categories?
You want a plugin like this:
<?php /* Plugin Name: noindex stuff */ add_action('bb_head', 'my_add_noindex_tag'); function my_add_noindex_tag() { if( is_forum_category() ) echo '<meta name="robots" content="noindex" />'; } ?>That's off the top of my head, so it may not work without some modification, but that's what I think the structure needs to be. You'll need a different conditional tag than is_forum_category(), probably is_forum() if you just wanted to not index forum pages.
-
- Posted 4 years ago #
Thanks Fel. I should have added more text:
I'd like to keep spiders out of forum category 3, but not forum category 4 or 5.Specifically I'd like that meta tag to be written to forum category 3 page that lists the threads, and all threads that are in forum category 3.
-
- Posted 4 years ago #
So you need to modify the if( ... ) statement to look for those properties. What are you having a problem with?
-
- Posted 4 years ago #
<?php /* Plugin Name: noindex stuff */ add_action('bb_head', 'my_add_noindex_tag'); function my_add_noindex_tag() { if( is_forum(3) ) { echo '<meta name="robots" content="noindex" />'; } else { echo '<!-- please do index -->'; } } ?>I modified it a bit to see both conditions... but neither are showing up in my source. Any thoughts?
I did see it in the plugins control panel, and activate it.
-
- Posted 4 years ago #
is_forum() doesn't take any arguments, so I believe you'd have to use the global var $forum, like so:
<?php /* Plugin Name: noindex stuff */ add_action('bb_head', 'my_add_noindex_tag'); function my_add_noindex_tag() { global $forum; if($forum->forum_id == 3) { echo '<meta name="robots" content="noindex" />'; } else { echo '<!-- please do index -->'; } } ?> -
- Posted 4 years ago #
Hmmm still not working. Something's strange because even this doesn't show:
<?php /* Plugin Name: test stuff */ add_action('bb_head', 'my_add_test_tag'); function my_add_test_tag() { echo '<!-- testing here -->'; } ?>I've tried activating/deactivating these plugins, and I've tried 2 browsers to ensure it's not cache I'm seeing. Grr.
-
- Posted 4 years ago #
bb_headappears to be a filter. -
- Posted 4 years ago #
Using latest trunk code, but bb_head works fine in combo with add_action here.
-
- Posted 4 years ago #
Hi just tried this code but therer is "is_forum_category()" function in my install (ver 0.83).
Is this a new one for the next version?
-
You must log in to post.