Please Help me with this wordpress php line

Discussion in 'Programming' started by tryingtolearn, Jun 7, 2009.

  1. #1
    Hello,

    I am using a script that adds the readmore link to the bottom of my posts after a certain amount of words. What I am trying to add is a line that would add the post title to the link after "Continue Reading" Here is what I have so far.

    global $post;
    
    		$homepage_excerpts_more = ' ... <a href="'.get_permalink().'" class="more-link"><br/><br/>Continue Reading...</a>';
    
    		$output = $content;
    
    PHP:
    What I am trying to add in is this line and I can't get it to work right. I really only need the ".get_the_title" added to the line above but I don't know how to get it to work.

    <?php the_content("...continue reading the story
    called " . get_the_title('', '', false)); ?>
    PHP:

    Any help would be appreciated. Thanks for all your time
     
    tryingtolearn, Jun 7, 2009 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Cash Nebula, Jun 7, 2009 IP
  3. tryingtolearn

    tryingtolearn Peon

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your help,

    After playing around with it I got it to work using...

    	$homepage_excerpts_more = ' ... <a href="'.get_permalink().'"class="more-link"><br/><br/>Continue Reading - '. get_the_title ('', '', false);'</a>';
    PHP:
    Don't know if this is actually the correct way to do it, but it works.

    Thanks again for your help
     
    tryingtolearn, Jun 7, 2009 IP
  4. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #4
    :eek: Seems that get_the_title doesn't need a post ID after all.

    I think the correct way to write it is get_the_title ($post->ID); but get_the_title(); might also work then.

    Anyway, as long as it works! :)
     
    Cash Nebula, Jun 7, 2009 IP