View Full Version : WordPress Template Tweak -- Customizing Home Page Links To Single Post

08-07-2012, 02:54 AM
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:

<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!

08-07-2012, 07:47 AM
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:

$permalink = get_permalink($post->ID);
if ( (get_post_type() == 'books') and !is_single() )
echo "<a href='$permalink'>get more info</a>"; ?>