#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)
#4
in reply to:
↑ 3
@
13 years ago
- Cc xoodrew@… added
Replying to scribu:
Why not use a shortcode instead?
[nextpage title=Conclusion]
+1 for the shortcode.
#5
@
13 years ago
../my-article/conclusion : maybe using WP_Rewrite?
Title for it : How about post_meta?
#6
@
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
@
12 years ago
My thought was that [nextpage]
could also handle the splitting, so you would still only need one line of code.
#8
@
12 years ago
So leave intact nextpage and create a shortcode duplicate to split with titles?
Sounds good :)
#9
follow-up:
↓ 10
@
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
#10
in reply to:
↑ 9
@
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
@
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
@
12 years ago
Almost complete, just time to solve some permalink issues that are driving me crazy o.O
#13
@
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
@
12 years ago
I'm proud to annunce that my first public WP Plugin is released in the first beta version :)
#15
@
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
@
12 years ago
Thanks for the suggestion :)
Maybe you can help me solving the infinite / and 404 not showing problem?
#17
@
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 handle code in the post.
It's: