Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Post format on front page WordPress

  • SOLVED

Hi.

WP: 3.5.1
Custom theme

i have 3 post post thumbnails on my front page, at the moment they link to the post permalink which is the blog but as i'm not having a blog i want them to link to another section of my site and i can't figure out how to do this

when i change the post format to link it dissappears off my homepage (as in the image below,( there was a third image which was post format link and it then vanished)
i think iv got two options, make the link format visable on my homepage or change the standard to be able to link to another page but i'm not sure how
i have found the bit of code that links to the permalink but even if i changed that it would change them all and i want each image to link to a seperate page

( [[LINK href="http://www.fudgekids.com/images/Problem1-PostLink.png"]]IMAGE[[/LINK]] )

Thank you in advance if anyone knows :)

Answers (1)

2013-04-28

Arnav Joy answers:

can you share the file where code is written.


Nicole_Nia comments:

this is the bit of the code that when i change the permalink it changes the links, but for all the images
<?php if ($instance['posttype'] == "testi") {
$custom = get_post_custom($post->ID);
$testiname = $custom["my_testi_caption"][0];
$testiurl = $custom["my_testi_url"][0];
$testiinfo = $custom["my_testi_info"][0];
}
$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_url( $thumb,'full'); //get img URL
$image = aq_resize( $img_url, $instance['thumb_w'], $instance['thumb_h'], true ); //resize & crop img
?>
<li class="cat_post_item-<?php echo $posts_counter; ?> clearfix">
<?php if ($instance["thumb"]) : ?>
<figure class="featured-thumbnail">
<?php if ( $instance['thumb_as_link'] ) : ?>
<a href="<?php the_permalink() ?>">
<?php endif; ?>
<?php if($instance['thumb_w']!=="" || $instance['thumb_h']!==""){ ?>
<img src="<?php echo $image; ?>" alt="<?php the_title(); ?>" />
<?php }else{?>
<?php the_post_thumbnail(); ?>
<?php }?>
<?php if ( $instance['thumb_as_link'] ) : ?>
</a>
<?php endif; ?>
</figure>
<?php endif; ?>


Sorry forgot to mention, my posts come in a widget called "My - Advanced Cycle" and the code above is from "my-post-type-widge.php"
this is my first wp site as you can probably tell, i didn't know how much of the code to paste, if you need any more info please let me know, ty for looking at my question


Arnav Joy comments:

you can provide link to the image using custom field for this page , see here for more information about the custom fields


http://codex.wordpress.org/Custom_Fields


so you have to change following line

<a href="<?php the_permalink() ?>">

to something like this

<a href="<?php echo get_post_meta(get_the_ID(),'YOUR_CUSTOM_FIELD_NAME',true); ?>">

so for example you have named your custom field as "post_link_url" then you can write is as

<a href="<?php echo get_post_meta(get_the_ID(),'post_link_url',true) ;?>">

let me know if you have understood what i want to say..


Nicole_Nia comments:

i did, and it worked :D
wow, i cannot thank you enough, this has been driving me crazy

i really appreciate it! thank youuu


Arnav Joy comments:

can you please vote for me ,now


Nicole_Nia comments:

yes sorry i was trying to figure our how to do it, done it now :) Thanks again