Ticket #4860 (new enhancement)

Opened 1 year ago

Last modified 10 months ago

Comments popup page needs a pretty URL

Reported by: JeremyVisser Assigned to: anonymous
Priority: low Milestone: 2.9
Component: Template Version: 2.3
Severity: minor Keywords:
Cc:

Description

Currently, the URL provided by comments_popup_link() to provide a link to a separate comments window looks like this:

http://localhost/wordpress/?comments_popup=13

It looks ugly, and is like that even when pretty permalinks are enabled.

Now, it'd be better if it were accessible from this URL:

http://localhost/wordpress/comments/popup/13

or maybe even this

http://localhost/wordpress/2007/01/01/hello-world/comments/

I managed to get the popup form accessible from http://localhost/wordpress/comments/popup/13 with a plugin. The significant code I used was (using the skills I learned today from DD32 -- thanks!):

function cp_comments_popup_rewrite_rules( $rules ) {
	$rules[ 'comments/popup/([0-9]+)' ] = 'index.php?comments_popup=$matches[1]';
	return $rules;
}

add_filter('rewrite_rules_array', 'cp_comments_popup_rewrite_rules');

However, it'd be better in core. From looking at the code, I was wondering if it should go in the WP_Rewrite::generate_rewrite_rules() function, but I've been staring at that function for about 10 minutes now, and now my eyes are all blurry. I don't understand it one bit.

How else can we acheive this?

Change History

12/27/07 21:00:30 changed by santosj

  • component changed from General to Template.

03/19/08 03:43:46 changed by ffemtcj

  • milestone changed from 2.5 to 2.6.