Make WordPress Core

Opened 13 years ago

Closed 11 years ago

Last modified 11 years ago

#20844 closed feature request (wontfix)

Specify titles using <!-- nextpage -->

Reported by: sgr33n's profile sgr33n Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

Hi,

I'm planning to code a plugin but maybe you're going to code it into WP core, so I prefer to ask before.

The idea is to modify <!-- nextpage --> code in order to give a title to every page, also better in SEO to have an url like www.wordpress.org/2012/my-article and www.wordpress.org/2012/my-article/conclusion/ instead of www.wordpress.org/2012/my-article/2/.

Maybe is possible to modify it this way: <!-- nextpageConclusion? -->

It's different from subpages because it will be usable on every post type, not even on pages, and you will create just one post, not more.

Last but not least you could have a page selector with titles not page numbers.

Thanks :)

Change History (19)

#1 @sgr33n
13 years ago

It's:

<!-- nextpage['Conclusion'] --> 

#2 @scribu
13 years ago

  • Summary changed from <!-- nextpage --> to Specify titles using <!-- nextpage -->

#3 follow-up: @scribu
13 years ago

Why not use a shortcode instead?

[nextpage title=Conclusion]

#4 in reply to: ↑ 3 @DrewAPicture
13 years ago

  • Cc xoodrew@… added

Replying to scribu:

Why not use a shortcode instead?

[nextpage title=Conclusion]

+1 for the shortcode.

#5 @arieputranto
13 years ago

../my-article/conclusion : maybe using WP_Rewrite?
Title for it : How about post_meta?

#6 @sgr33n
12 years ago

Maybe good using shortcodes but in this case you need to insert two lines of code. With the

<!-- nextpage --> 

Syntax first you can preserve legacy, then you can use just one line of code.

#7 @scribu
12 years ago

My thought was that [nextpage] could also handle the splitting, so you would still only need one line of code.

#8 @sgr33n
12 years ago

So leave intact nextpage and create a shortcode duplicate to split with titles?
Sounds good :)

#9 follow-up: @sgr33n
12 years ago

Update: I'm coding it as shortcode, even if it is not really a shortcode because you cannot handle it using add_shortcode... anyway, I'm asking why using

$wp_rewrite->pagination_base

It returns the link www.site.com/2012/06/title/page/nextpagetitle, and if I use the regular
nextpage the link is www.site.com/2012/06/title/nextpagetitle, even if the core function uses $wp_rewrite->pagination_base

? :P

Last edited 12 years ago by sgr33n (previous) (diff)

#10 in reply to: ↑ 9 @duck_
12 years ago

Replying to sgr33n:

The pagination_base is used for paging of archives (e.g. category archives or date archives). It is not used for pagination of single posts or pages with multiple pages.

#11 @sgr33n
12 years ago

Thanks Duck,

Nevertheless, reading the code it seems that WP calls pagination_base also for single posts:
From wp-includes/link-template.php (line 1422)

function get_pagenum_link($pagenum = 1, $escape = true ) {
[...]

		if ( $pagenum > 1 ) {
			$request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' );
		}

[...]
}

#12 @sgr33n
12 years ago

Almost complete, just time to solve some permalink issues that are going me crazy o.O

Version 0, edited 12 years ago by sgr33n (next)

#13 @sgr33n
12 years ago

Everything works now, even url rewrites but maybe something is wrong because even if I call a page like www.site.com/2012/06/posttitle/pagetitle/dasdsadas/dasdasdas/dasdsadsa/ WP returns the page, not even the 404 o.O can somebody help?

#14 @sgr33n
12 years ago

I'm proud to annunce that my first public WP Plugin is released in the first beta version :)

http://wordpress.org/extend/plugins/sgr-nextpage-titles/

#15 @scribu
12 years ago

I took a look at your code and I think you could actually rely on the shortcode parsing and the old nextpage tag:

function nextpage_shortcode( $attr ) {
  $global $nextpage_shortcodes;

  $nextpage_shortcodes[] = $attr['title'];

  return '<!--nextpage-->';  // Let WP handle splitting the content
}
add_shortcode( 'nextpage', 'nextpage_shortcode' );

Later, you can use the $nextpage_shortcodes global array to figure out which title to show.

#16 @sgr33n
12 years ago

Thanks for the suggestion :)
Maybe you can help me solving the infinite / and 404 not showing problem?

#17 @sgr33n
12 years ago

Anyway I tried your suggestion... my impression is that Wordpress handles the

<!--nextpage-->

Code before it handles shortcodes, so in this way you can see the not handled code in the post (source because html handles it as a comment).

Last edited 12 years ago by sgr33n (previous) (diff)

#18 @c3mdigital
11 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

sgr33n,
Cool looks like your plugin takes care of this. Closing as wont fix.

#19 @DrewAPicture
11 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.