Support » Developing with WordPress » Post-Title in the <!–nextpage–> Link ?

  • Hi, i would like to have the Post-Title in th <!--nextpage--> Link, but i dont know what the correct Syntax for this would be.
    I tried to modify the original code <?php wp_link_pages('pagelink=Page %'); ?> like this:

    <?php wp_link_pages('pagelink=php the_title() %'); ?>

    But it doesnt work. 🙁

    Can someone tell me how to do this? Is there a possibiltity, or can it not be done?

    Thanks, Sab.

Viewing 12 replies - 1 through 12 (of 12 total)
  • in my theme, i use <?php wp_link_pages(); ?> ONLY and it does work. give it a try

    Oh, thank you very much for your answer, but that works in my theme too, maybe i didnt explain clearly enough what i want to achieve:
    I want to modify the nextpage Link in that way that it would include the post-title in the link, so instead of “2” or “nextpage” or “Page 2” it would read: “post-title-Page-2”.

    have u ever thought about how it looks if you add “page 2”?

    it would be bad to display “Page 1 Page 2 Pae 3”

    try look one of the files in wp-include, i open all those files and search for keywords. works most of the time.

    The “%” in the original code wp_link_pages('pagelink=Page %') is replaced with the number of the page automatically.
    And yes, i looked in the includes, and the whole thing is inside the post-template, but i dont understand enough php to be able to change it the way i want. 🙁

    but you want to display it like:
    post-title-page-2 post-title-page-3 post-title-page-4

    right now i have this version:
    Pages: title1 title2

    don’t have the demo since i use localhost 🙂 but i can send u the code or file if u need


    well i think that “title1 Title2” version would be what i had in mind.
    If you can not post the code here, great if you want to send it to me, my address is karlogaga (at) yahoo (dot) com.

    not sure if it’s good to post the code here, anyway, i get it a try: BACKUP BEFORE U TRY IT

    1. put this <?php wp_link_pages(); ?> into single.php
    2. open post-template.php. at line 133 , where u see the line : global $post;
    add this below it:

    $idd = get_the_ID();
    	$findtitle = mysql_query("SELECT post_title FROM wp_posts WHERE ID = $idd");
    	$row = mysql_num_rows($findtitle);
     	$i = 0;
    	while($row > $i){
    		$dbrow = mysql_fetch_assoc($findtitle);
    		$oai = $dbrow['post_title'];

    4. few lines down, you will see this line:
    $defaults = array bla bla, and change the Pages: word or delete it if u like.
    5. find these lines:

    if ( ($i != $page) || ((!$more) && ($page==1)) )
    					$output .= '</a>';

    just above of it, there is a line like this:

    $output .= $j;

    change it to

    $output .= $oai . $j;

    that’s all. a bit coding/copying but it does work.

    if not, i will send the file and u can take a look at it. cheers

    Thank you very much for the effort, but that is not what i wanted.
    With a lot of luck I finally found a possibility through trial and error, but it is not really beautiful, cause it keeps the post-title outside of the link additionally.
    You can look at it here, at the end of the post there is a link to the second page, in german its “Seite 2”.

    yes, i had same problem with that but my solution works just like your describe. is your post-template.php original ? if it’s not have been edited before, then i can send you the copy of the file when i come home.

    i checked your site and i can see “Der YOUPORN Kult Seite 2” is a link, is that not what you want? as these:
    Weitere Seiten: <link>Der YOUPORN Kult Seite 1</link> Der YOUPORN Kult

    what do u want to do here? remove Seite 2 or?


    what i wanted was a link like this one for the next page or previous page:

    <link>Der YOUPORN Kult Seite 2</link>

    where “Der YOUPORN Kult” is taken from the post-title and “Seite 1 or Seite 2” is added depending on the next/previous page number.

    Now this is working, but as you can see, next to the link the post-title appears a second time outside of the link:

    “<link>Der YOUPORN Kult Seite 1</link> Der YOUPORN Kult”

    I dont know how to fix this yet 🙁

    check your email. i sent the file so u just replace it. if u can, send your copy to me and i can look at it, just to know what you edited.


    edit: how is my “test” image to show you what i got

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Post-Title in the <!–nextpage–> Link ?’ is closed to new replies.