WordPress.org

Ready to get started?Download WordPress

Forums

Pinboard
[resolved] Link image to post from main page when using Image format (14 posts)

  1. patricksunset
    Member
    Posted 1 year ago #

    I would like to know how to link the image in a post using the "Image" post format to go to the post instead of the image. I know how to write HTML and CSS and tweak PHP... there is some function of Pinboard that strips out any HTML on the image, so if I hand code the link on the image to go to the post, it will not work. I cannot figure out where this function is however. Thanks!

  2. patricksunset
    Member
    Posted 1 year ago #

    In functions.php, I found:

    $image = wp_get_attachment_image_src( $attachment->ID, 'full' ); ?>
    				<figure>
    					<a>" title="<?php the_title_attribute(); ?>" class="colorbox"  rel="attachment">
    						<?php echo wp_get_attachment_image( $attachment->ID, 'image-thumb' ); ?>
    					</a>
    				</figure>

    and took out the link, to make it:

    $image = wp_get_attachment_image_src( $attachment->ID, 'full' ); ?>
    				<figure>
    
    						<?php echo wp_get_attachment_image( $attachment->ID, 'image-thumb' ); ?>
    
    				</figure>

    Now I just need to figure out how to make the image go to the post. pinboard_post_link maybe?

  3. patricksunset
    Member
    Posted 1 year ago #

    Figured it out! Just had to use "<?php the_permalink() ?>">

    So the final code in functions.php is:

    $image = wp_get_attachment_image_src( $attachment->ID, 'full' ); ?>
    				<figure>
    
    						<a href="<?php the_permalink() ?>"><?php echo wp_get_attachment_image( $attachment->ID, 'image-thumb' ); ?></a>
    
    				</figure>
  4. Celeste1212
    Member
    Posted 1 year ago #

    Hi, Patrick. Can you give us the link to your site so we can see what you've done and how it looks? Thanks :)

  5. patricksunset
    Member
    Posted 1 year ago #

  6. Celeste1212
    Member
    Posted 1 year ago #

    Sorry it took so long to respond, I forgot to check my e-mail :)

    Thanks for the link. Your site looks good! Very clean but colorful.

  7. sleepything
    Member
    Posted 1 year ago #

    Patrick, i did same thing but it didnt work out. Could you help me, i also want to link main picture to the post itself. My site is http://www.bezbashny.com
    I changed preferences to way you wrote but there is a picture box after click. Thanks

  8. sleepything
    Member
    Posted 1 year ago #

    Also i am curious how to make readmore button on the main page. Because i can go inside the post only after clicking header. Thanks

  9. Andrew
    Forum Moderator
    Posted 1 year ago #

    If you need support for your issue, Sleepything, it would be best to start up a new thread.

  10. patricksunset
    Member
    Posted 1 year ago #

    Hi sleepything, sorry it has taken me so long to respond. The only thing I can think of is that there are two instances of <?php echo wp_get_attachment_image( $attachment->ID, 'image-thumb' ); ?> in functions.php -- so either change both of them to <a href="<?php the_permalink() ?>"><?php echo wp_get_attachment_image( $attachment->ID, 'image-thumb' ); ?></a> or just change the on that you didn't change.

  11. somethingaboutparis
    Member
    Posted 1 year ago #

    I have been searching for this solution for ages! Thanks Patrick!

  12. herrkarlson
    Member
    Posted 7 months ago #

    Bump.

    And this doesn't seem to work for me. Also, the site on your link doesn't seem to do what you say it does. I'm guessing some update screwed it up for you, Patrick?

    Is there anyone who has a working fix for this. It's quite strange to me that the standard is for the pics not to lead to the post but...

    Thanks

  13. patricksunset
    Member
    Posted 7 months ago #

    Hi herrkarlson,
    Thanks for pointing that out, it seems an update screwed it up. I reinserted my fix and it's working again. I wish I knew why it's not working for you. Give me some clues?

  14. herrkarlson
    Member
    Posted 7 months ago #

    I got it to work after removing "div.zoomed { zoom: 3; -moz-transform: scale(3); -moz-transform-origin: 0 0}" from style.css

    I guess it didn't realized the window was at the bottom of the screen and therefore didn't call the infiscroll function.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.