MU Advanced: Issues and Discussion
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • September 03, 2010, 12:31:40 PM
Home Forums Contact Tags FAQ Links News Login Register
* *
Navigation Menu
Search

Random Quotes
Ever mind the rule of three, Three times your deeds return to thee. This lesson well, thou must learn, thee only gets what thou does earn.
- Lady Gwen
Pages: [1]   Go Down
  Print  
Author Topic: top level categories  (Read 1450 times)
0 Members and 1 Guest are viewing this topic.
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« on: November 17, 2008, 03:44:16 PM »

I am trying to make my categories map to "top level"... in the past on older builds of single instance wp, I used this handy plugin, and it worked like a charm: http://fortes.com/2007/02/top-level-categories-plugin-01/

But now, I'm also trying to mix using a permalink structure of /%category%/%postname/ and well... all hell is breaking loose.

I know, this is strictly forbidden by several forum posts across the official wp support forums...

But I gotta believe there's a way to do this!!!

I am willing to hard code the urls in my .htaccess even... as these won't be changing much... but when I use:

RewriteRule ^cat1/cat2/$ /index.php?category_name=cat1/cat2 [L,NC,QSA]

Wordpress decides this should actully map into...

/index.php?category_name=cat1&name=cat2 [L,NC,QSA]

which attempts to show the post names cat2 in the cat 1 category.

Any suggestions?
Logged

Yep, that's me... riding my bike 204 miles in one day.
Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #1 on: November 17, 2008, 03:47:54 PM »

Beats me. I use a top level cats plugin (I think that's the one), with cat/postname.

Works OK for me, as far as I know. lol
If not, nobody's told me otherwise.

Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« Reply #2 on: November 17, 2008, 03:52:31 PM »

Well, I thought it was working at first, but it's been acting really weird on me...

I think I might have just had a breakthrough for how to get this to work... without hacking.

cross my fingers...
Logged

Yep, that's me... riding my bike 204 miles in one day.
Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #3 on: November 17, 2008, 04:02:40 PM »

Cool.

Although I'm not personally against hacking since you can put the code under SVN, then do merges with MU's trunk. Smiley
Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« Reply #4 on: November 17, 2008, 04:07:41 PM »

Luke, can you check on the plugin you are using and see what version/source it is...

If it's the same one I'm using, can you check to see if you hacked it to get it to work with /cat/postname....

I would really appreciate it.
Logged

Yep, that's me... riding my bike 204 miles in one day.
Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #5 on: November 17, 2008, 04:18:45 PM »

Can't say I hacked it a lick. What MU version are you working with?

Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #6 on: November 17, 2008, 04:21:24 PM »

It's the same one, yep.
http://fortes.com/projects/wordpress/top-level-cats/

I'm not 100% sure if there is a /cat/postname/ structure on the couple of 2.6 sites that have it though. If there is, there haven'tt been any problems reported.
Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« Reply #7 on: November 17, 2008, 04:23:55 PM »

I'm using 2.6.x (mostly 2.6.1)
Logged

Yep, that's me... riding my bike 204 miles in one day.
Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #8 on: November 17, 2008, 04:26:30 PM »

Interesting.

Although the site does mention that cat/postname won't work. Dunno why. Haven't put much thought or time into it at all.

Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
ZappoMan
Full Member
***

Karma: 1
Offline Offline

Posts: 157



View Profile
« Reply #9 on: November 17, 2008, 04:33:16 PM »

Well, I'm getting close to a solution that will work for me...

Trapping the 'request' filter, looking for my category urls, and remapping them to the category_name should work... then also handling the other filters that just remap urls before they're rendered on the page.

It looks like I'll be able to avoid most of the rewrite mumbo-jumbo...

Logged

Yep, that's me... riding my bike 204 miles in one day.
Luke
Key Master
*****

Karma: 5
Offline Offline

Posts: 3710



View Profile WWW
« Reply #10 on: November 17, 2008, 05:08:22 PM »

Yeah, there are a lot of things that get overcomplicated.

If the url is properly formed, you should be able to skip 99% of the rewrite rules completely.

Example: User says their structure is /cat/postname/

You're hitting the database anyway, so you could grab an array of cats (and top level pages), then see if /cat/ is in that array. If so, grab an array of post titles associated with that cat. Does /postname/ exist in that array? If so, serve it.

Note that nothing in the query string touched the database? Smiley

Of course there's more to it than that, but that's a basic working of a permalink system. Just not WordPress'. Although it's similar. They all are overall.

Logged

10 frames?
Heh, that's for Quakers.

Note: This message may be Canadian friendly.

"Pornographic monster on the floor"
Tags: categories 

Pages: [1]   Go Up
  Print  
 
Jump to:  


Login
 
 
Recent Posts
Recent Topics
No new topics.
Hot Tags
Whos Online
10 Guests, 0 Users
Home Forums Contact Tags FAQ Links News Login Register