1 deslea Jun 08, 2014 06:33
3 deslea Jun 08, 2014 16:21
Hi @mgsolipa
Thank you, that's exactly what I wanted! I'm trialling using it to limit the main stream to just my welcome message (which has a cat of its own) for now, but I can see a few different ways I can use it. Thanks so much!
Cheers - Deslea
4 deslea Jun 08, 2014 17:57
Just a follow-up - I had to stop doing this because it made the Permalinks in the Sealed Section fail. So it's back to the drawing board!
5 deslea Jun 08, 2014 21:47
I've got a fix for the permalinks problem. (It occurred to me later that this might be a skin-specific problem, too - I'm using Custom).
Set $cat = n;
in index.php (where n is the id for the category to suppress). This suppresses the category in the main stream on index.php, as expected.
In _blog_main.inc.php, go to about line 137, just under:
if( preg_match( $blog_baseuri_regexp, $ReqPath, $matches ) )
{ // We have extra path info
$path_string = $matches[2];
B2evolution has pulled out most of the originating URL for us so we can figure out whether this is a single post that should have the category setting put back. (I tried using $_SERVER earlier on but it didn't populate for some reason). Add the following:
// Fragment to allow a suppressed category for individual posts (otherwise permalinks in the suppressed category fail).
$trim_ReqPath = str_replace("/blog/index.php", "", $ReqPath);
// Strips off the "real" URL before the slugs. You may need to edit the path.
$url_trimmed = trim($trim_ReqPath, "abcdefghijklmnopqrstuvwxyv-");
// Takes the part after index.php and strips off everything but the forward slashes
IF ($url_trimmed == "/") { $url_type = "post"; }
// Checks for a single forward slash remaining- this suggests a post
// This is not foolproof - individual malformed category URLs may also be detected here
// However, these are not affected by the $cat setting
IF ($url_type == "post") {
$cat = '';
// Overrides the $cat = n that applied to index.php
}
Hello @deslea,
Did you considered to use the parameter
$cat
to exclude your Sealed Section category?Basically, you may add
$cat = -categoryID
to the stub file (index.php in your case), in order to exclude that category from the main stream (more info in this page: http://b2evolution.net/man/url-params).