- This topic is empty.
-
AuthorPosts
-
September 6, 2011 at 8:55 pm #34241FaberunaMember
OK, here’s what I’d like to do: I’d like it if a visitor to http://www.faberunashop.com/ had the ability to click on one of the homepage images and be directed to another site, the site of the featured vendor, versus going into a post. Is that done in the custom field or is that a CSS adjustment?
September 6, 2011 at 9:25 pm #86549TheDocMemberYou could definitely do it via a custom field.
September 6, 2011 at 9:29 pm #86550FaberunaMemberSo, the question is: what do I put in the custom field.
September 6, 2011 at 10:05 pm #86553TheDocMemberDepends on how your home page is set up. Presumably you would simply put in the URL you are wanting to redirect to. Then, in your home.php or front-page.php template you will replace the_permalink with your custom field.
September 6, 2011 at 10:31 pm #86555FaberunaMemberok. I will give it a try.
September 6, 2011 at 10:38 pm #86556FaberunaMemberWhen I do the custom field, do I use a href=”http://www.debreardonsart.com/” or just http://www.debreardonsart.com for instance?
September 6, 2011 at 11:01 pm #86557FaberunaMemberSo, I altered the functions.php & the index.php so that if you click on the post title you get to an external link. How do I do it to the rollover image?
September 6, 2011 at 11:10 pm #86558FaberunaMemberHere’s the code I used:
function print_post_title() {
global $post;
$thePostID = $post->ID;
$post_id = get_post($thePostID);
$title = $post_id->post_title;
$perm = get_permalink($post_id);
$post_keys = array(); $post_val = array();
$post_keys = get_post_custom_keys($thePostID);
if (!empty($post_keys)) {
foreach ($post_keys as $pkey) {
if ($pkey=='url1' || $pkey=='title_url' || $pkey=='url_title') {
$post_val = get_post_custom_values($pkey);
}
}
if (empty($post_val)) {
$link = $perm;
} else {
$link = $post_val[0];
}
} else {
$link = $perm;
}
echo ''.$title.'
';
}Then:
Once that’s done, open your index.php file and replace the standard code for printing titles…
" rel="bookmark" title="Permanent Link to ">
… with a call to our newly created print_post_title() function:
Now, whenever you feel like pointing one of your posts’ titles somewhere other than your own blog, just scroll down in your post editor and create or select a custom key called url1 or title_url or url_title and put the external URL in the value box.
September 6, 2011 at 11:43 pm #86559TheDocMemberI’m not really sure what theme you are using or what’s happening here.
All I would have done was created a custom field, and then changed where ever it’s calling the_permalink with it.
September 7, 2011 at 1:23 am #86560FaberunaMemberI’m a little dense so I don’t really know how to do that. The theme is this one: http://wpshower.com/themes/imbalance/
September 7, 2011 at 1:48 am #86561TheDocMemberAh – okay. So if you post the code for whatever is creating your home page (whether it be index.php, home.php or front-page.php) I’ll be able to help you from there!
September 7, 2011 at 1:57 am #86562FaberunaMemberSeptember 7, 2011 at 12:43 pm #86602TheDocMemberPerfect. So I would change this:
to this:
Then create a custom field called ‘url’ and put in the website.
September 7, 2011 at 1:28 pm #86606FaberunaMemberThanks for your help. I will try and get back to you.
September 7, 2011 at 1:35 pm #86607FaberunaMemberPerfect! Thanks!
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.