...

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



bswb97
08-07-2012, 01: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:


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

bswb97
08-07-2012, 06: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:


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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum