treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Help link to page instead of post using custom field

  • Hi, I'm using the Imbalance theme for our site www.finedecor.se and have stumbled upon a problem. I want to have all posts in main page linked to different address' instead of the corresponding post and permalink. I tried to use a solution found here and provided by the user "The Doc":

    http://css-tricks.com/forums/discussion/13569/custom-field-or-/p1

    using a custom field with the proper address but that takes only care of one of the links orpost. I have solved it temporarily with a html redirect but that isn't as effective as it could be.

    I found a site using Imbalance that works like I want: www.eduardorh.com

    my original code in index.php

    <div class="preview"><?php echo "$thumbID"; ?></div>

    and here's the solution provided by TheDoc:

    <div class="preview"><a href="<?php echo get_post_meta($post->ID, 'link2blog', true); ?>"><?php echo "$thumbID"; ?></a></div>

    Question is how to solve if you have multiple (nine) post with nine different custom fields? I'm thinking of some sort of if-sentence but my knowledge is somewhat limited.

    Thanks in beforehand for any help on this! Please let me know if you need to whole index.php

  • Solved: It was me not knowing exactly how the custom field worked. Obviously you should set one custom field and then at each post call for that custom field with a unique value set for each post. Thank you TheDoc for the solution provided.