WordPress.org

Make WordPress Core

Opened 23 months ago

Closed 8 months ago

Last modified 8 months ago

#20844 closed feature request (wontfix)

Specify titles using <!-- nextpage -->

Reported by: 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)

comment:1 sgr33n23 months ago

It's:

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

comment:2 scribu23 months ago

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

comment:3 follow-up: scribu23 months ago

Why not use a shortcode instead?

[nextpage title=Conclusion]

comment:4 in reply to: ↑ 3 DrewAPicture23 months ago

  • Cc xoodrew@… added

Replying to scribu:

Why not use a shortcode instead?

[nextpage title=Conclusion]

+1 for the shortcode.

comment:5 arieputranto23 months ago

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

comment:6 sgr33n22 months 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.

comment:7 scribu22 months ago

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

comment:8 sgr33n22 months ago

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

comment:9 follow-up: sgr33n22 months ago

Update: I'm coding it as shortcode, even if it is not really a shortcode becouse 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

Version 0, edited 22 months ago by sgr33n (next)

comment:10 in reply to: ↑ 9 duck_22 months 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.

comment:11 sgr33n22 months 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' );
		}

[...]
}

comment:12 sgr33n22 months ago

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

Last edited 22 months ago by sgr33n (previous) (diff)

comment:13 sgr33n22 months 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?

comment:14 sgr33n22 months 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/

comment:15 scribu22 months 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.

comment:16 sgr33n22 months ago

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

comment:17 sgr33n22 months 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 22 months ago by sgr33n (previous) (diff)

comment:18 c3mdigital8 months 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.

comment:19 DrewAPicture8 months ago

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