rhythmdoctor
Member
Posted 2 years ago #
Hello,
I am trying to create multi-paged posts with a link at the bottom that says "Continue Reading POSTNAME - Part 1,2,etc..."
I cant figure out how to echo the title/postname in this link. So far I have
<?php wp_link_pages('before=Continue Reading - &after='); ?>
I keep thinking that this must be simple but cant seem to figure out. Have tried putting
<?php wp_link_pages('before=Continue Reading <?php the_title(); ?> - &after='); ?> and tried with "echo" in there as well... What am I missing. Any help would be greatly appreciated. Thanks
You've got a nested <?php...?> there. Try:
<?php wp_link_pages('before=Continue Reading '.the_title().' - &after='); ?>
rhythmdoctor
Member
Posted 2 years ago #
Thanks a bunch. Only problem is that it switches the title with "continue reading" so that Continue reading is after the post title. Title shows though so that is a start.. Got to figure out how to have it, for example do
Continue Reading - This is my Post title - Part 1 2
rhythmdoctor
Member
Posted 2 years ago #
Also noticed that this shows the title on pages that dont have <!nextpage> assigned - so it is showing the title at the bottom of all posts. Hmmm.
Only problem is that it switches the title with "continue reading"
Doh! Forgot about that problem. you need to use get_the_title().
Try:
<?php if(is_paged()) wp_link_pages('before=Continue Reading '.get_the_title().' - &after='); ?>
is_paged
rhythmdoctor
Member
Posted 2 years ago #
Bummer, well that shows nothing at all now... Ah heck. ;-)
rhythmdoctor
Member
Posted 2 years ago #
This seems to almost work -
<?php wp_link_pages('before=Continue Reading - '.get_the_title().' - Part &after='); ?>
Except 1) "-Part" Doesnt show and 2) The title only shows 2 words... hmm.
Thanks though, this is much better.
rhythmdoctor
Member
Posted 2 years ago #
Ahhh, I had a "&" in my title and it seemed to choke on that. Once I changed it to "and", it worked...
rhythmdoctor
Member
Posted 2 years ago #
Thanks a bunch for the help.