SimpleFolio Customization: Use custom field to control homepage slider links

Posted February 20th, 2011 in Public and tagged , by Nick Cron

Follow the steps below to change the behavior of SimpleFolio on the home page to link wherever you want instead of the single post page.

Start by adding a custom field to your post called “link”

Next, modify the “template_home.php” file located at /<root>/wp-content/theme/simpifolio

Find the following on Line 21:


$thumb = get_post_meta($post->ID, 'thumb-large', true);

Add this:


$link = get_post_meta($post->ID, 'Link', true);

Find this on line 24:


<li>
<a href="<?php the_permalink(); ?>"><img src="<?php echo $thumb; ?>" alt="<?php the_title() ?>" /></a>
<span><h3><?php the_title() ?></h3> <?php the_content_limit($text_count, ''); ?></span>
</li>

Replace with this:


<li>
<a href="<?php echo $link; ?>"><img src="<?php echo $thumb; ?>" alt="<?php the_title() ?>" /></a>
<span><h3><?php the_title() ?></h3> <?php the_content_limit($text_count, ''); ?></span>
</li>

Now you can create a post for the homepage slider and can direct users to any page you wish, just change the value in the “Link” custom field.

Share this Post

  • Robson

    Hey up Nick, thanks for this post – helpfull stuff for me trying to work this out. By the way the image unde the line “Start by adding a custom field to your post called “link” – doesn’t load

  • Anonymous

    Thanks Robson – thanks for pointing that out. I have fixed.

  • http://profiles.google.com/andrewjoelpeters Andrew Peters

    Thanks!

  • http://twitter.com/davidmasters David Masters

    Thank you! I followed these instructions, and they worked, but the line of text no longer shows up at the bottom of the slider. What can I do to fix this?

    Thanks!

    David

  • http://twitter.com/davidmasters David Masters

    It also doesn’t cycle between images (it’s stuck on a single image)

  • http://twitter.com/davidmasters David Masters

    I got it workign with the following code:

    <a href="”><img src="” alt=”" />

  • Anonymous

    David – looks like some kind of syntax issue.  Sorry for not responding – vacation this week.

  • Ryan

    Noob alert – what is the ideal height/width for slider images on home page?

blog comments powered by Disqus