WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Link Photo to Single Post (10 posts)

  1. Turntable
    Member
    Posted 3 years ago #

    I'm making a photo blog with each post having a single photo no text.

    How do I link the photo to the single post from the main content page without the photo linking when viewing the single post?

    In other words when someone is viewing the main website I want them to be able to click on the title or photo to take them to the single post. But when they are viewing the single post I do not want the image to be linked at all.

    thanks in advance.

  2. keesiemeijer
    moderator
    Posted 3 years ago #

    Use post thumbnails and use the example of linking to the post with the_post_thumbnail: http://codex.wordpress.org/Function_Reference/the_post_thumbnail#Post_Thumbnail_Linking_to_the_Post_Permalink

    What theme are you using?

  3. Turntable
    Member
    Posted 3 years ago #

    I'm using a custom theme. Each photo is not a small thumbnail but full size.

    Photo Width is fixed 500px, Height is variable.

    What exactly do I put in the loop for this to work?

    thanks

  4. keesiemeijer
    moderator
    Posted 3 years ago #

    Can you put the content of your theme's index.php in the http://wordpress.pastebin.com/ and give a link back to it here.

  5. keesiemeijer
    moderator
    Posted 3 years ago #

    With post thumbnails you can have many different sizes. see add image size A post thumbnail isn't necessarily a thumbnail. You can also show the large size.

  6. Turntable
    Member
    Posted 3 years ago #

    http://wordpress.pastebin.com/Sb7wKfbL

    If you know a good theme for doing what I need I'm open to suggestions.

    thanks for your help kees

  7. keesiemeijer
    moderator
    Posted 3 years ago #

    Put this in your functions.php:

    if ( function_exists( 'add_theme_support' ) ) {
    	add_theme_support( 'post-thumbnails' );
            set_post_thumbnail_size( 150, 150 ); // default Post Thumbnail dimensions
    }
    
    if ( function_exists( 'add_image_size' ) ) {
    	add_image_size( 'large_photos', 500, 9999 ); //500 pixels wide (and unlimited height)
    
    }

    Now you can insert a post thumbnail when you edit or create a post

    and use this as your index: http://wordpress.pastebin.com/TJCfh0GJ

    Can you put single.php also in the pastebin so we can show the photo also there but without the link.

  8. Turntable
    Member
    Posted 3 years ago #

    here is the single.php http://wordpress.pastebin.com/cmNM61iS

    thanks and how do you add a thumbnail to the post is it different then just inserting a photo to the post?

  9. keesiemeijer
    moderator
    Posted 3 years ago #

    No, you can insert as normal but now next to "Insert into Post" you can click a link "Use as featured image". There is also a new sidebar panel called "Features Image" when you edit or create a post.

  10. keesiemeijer
    moderator
    Posted 3 years ago #

    try this for single.php: http://wordpress.pastebin.com/WLqX1WLH

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags