SimpleFolio Customization: Use custom field to control homepage slider links

February 20th, 2011 Posted by Public 13 comments on “SimpleFolio Customization: Use custom field to control homepage slider links”

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.

Tags: ,
  • 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.

        • Rob

          Hi, David – thanks for the fix. Where exactly are you inserting this bit of code?

          • Nick Cron

            Rob – this would be in the template-home.php file. This should not really be required. Here is an additional example where i added a read more link when using this area for news content.


            <a href=""><img src="" alt="" />
            <a href="">Read More

          • http://inkably.com/ David Masters

            Instead of

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

            (see instructions in blog post)

          • Rob

            I really appreciate the reply. I’m sure I’m being dim, maybe missing some shorthand… except for , this “instead of” is the same as the code you posted earlier. I can’t find any other similar code in nickcron’s replacement code.

            Here’s what I currently have:
            <a href="”><img src="” alt=”” />

        • Rob

          Interestingly, I tried placing just the “<img alt=" through "” line under the replaced line 24. I now get the rotating slider, plus the line of text, though the text comes down from the top… Sorry, this is a bit new to me…

  • Ryan

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