Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2012
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts

    WordPress Template Tweak -- Customizing Home Page Links To Single Post

    I'm fairly new to WordPress theme programming but I think this will be a pretty easy answer for the community.

    On my Home page, I am customizing excerpt content. I want to customize the Read More link below some other customized excerpt content.

    How do I call out the post URL in a PHP echo statement? I tried this:

    PHP Code:
    <?php
    <a href="'. get_permalink($post->ID) . '"Get more info...</a>;
     
    ?>
    It gave me a nasty error that didn't show up when I used just a traditional URL in the HREF field...so, I figure there's something wrong with the callout. Help!

  • #2
    New Coder
    Join Date
    Mar 2012
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I solved my own problem after poking around various forums. I'm sure PHP vets know this but for fellow newbies I first set the variable and then called it out:
    PHP Code:
    <?php  
    $permalink 
    get_permalink($post->ID);
    if ( (
    get_post_type() == 'books') and !is_single() )
        echo 
    "<a href='$permalink'>get more info</a>"?>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •