wordpress --- is this possible
-
TerryLon
- Verified Member

- Posts: 165
- Joined: April 17th, 2018, 9:22 am
wordpress --- is this possible
I have one blog with 78 categories, can I start 2 other blogs, use the same database, but not show certain categories on the other 2?
Thanks
Thanks
-
Colmike7
- Banned

- Posts: 1670
- Joined: May 23rd, 2018, 12:21 pm
- Title: (>^-^)b
In functions.php:
function exclude_category_home( $query ) {
if ( $query->is_home ) {
$query->set( 'cat', 'IDNumber' );
}
return $query;
}
add_filter( 'pre_get_posts', 'exclude_category_home' );
Change IDNumber to the category number.
This just hides them, though, is that what you want?
function exclude_category_home( $query ) {
if ( $query->is_home ) {
$query->set( 'cat', 'IDNumber' );
}
return $query;
}
add_filter( 'pre_get_posts', 'exclude_category_home' );
Change IDNumber to the category number.
This just hides them, though, is that what you want?
-
TerryLon
- Verified Member

- Posts: 165
- Joined: April 17th, 2018, 9:22 am
Thanks will try. Just the quick question is that on the main blog or for the other blogs.
-
Colmike7
- Banned

- Posts: 1670
- Joined: May 23rd, 2018, 12:21 pm
- Title: (>^-^)b
The other blog, basically that just hides categories from the home page, or you could delete an if statement and make it on the whole blog.
That won't do anything like import only X-categories and not posts from Y-categories on the new blogs, though, it just hides the cat links on the blog.
If you do want to import only posts from specific categories and not others, though, I can show you that, too. Slightly different.
Hope my wording makes sense, very long day lol
- bill
- Verified Member

- Posts: 8259
- Joined: February 3rd, 2018, 3:36 pm
-
Colmike7
- Banned

- Posts: 1670
- Joined: May 23rd, 2018, 12:21 pm
- Title: (>^-^)b
That code is very helpful for blogs where you have uncategorized posts and want to hide that.
- jag
- Verified Member

- Posts: 6527
- Joined: February 15th, 2018, 9:51 am
- Title: From Malta with love
- Referrals: 1
What if you use the same database but on the 2nd blog do not create all the same categories, wouldn't that be easier.Or is that not a possibility.
From Malta with love and sunshine
- LuKenGas
- Verified Member

- Posts: 2209
- Joined: February 23rd, 2018, 8:07 am
I doubt it
- bestfreeporn
- Verified Member

- Posts: 2308
- Joined: February 20th, 2018, 6:34 pm
- Referrals: 1
no see what colmike7 posted
-
ispdn
- Verified Member

- Posts: 1446
- Joined: March 25th, 2018, 8:23 pm
- gotonudecom
- Verified Member

- Posts: 3169
- Joined: February 6th, 2018, 1:54 pm
- Title: DomainMaster
- Referrals: 30
- Contact:
This is a great idea.
- Terry
- Verified Member

- Posts: 774
- Joined: March 5th, 2018, 6:23 pm
That is more work just do the code modification suggested
- Russ
- Verified Member

- Posts: 1282
- Joined: March 4th, 2018, 7:44 am
-
xxxman
- Verified Member

- Posts: 438
- Joined: April 7th, 2018, 1:01 pm
- TheButcher
- Administrator

- Posts: 17526
- Joined: February 2nd, 2018, 11:48 am
- Title: I like weekends
- Referrals: 1
- Contact:
You know how Google treats duplicate content?