• Hello all. I’m creating a review site/blog and the first bit of every post is an image of the boxart. On the main page it’s a little odd not being able to click the image to enter the post. I could edit it after putting the post on but that seems time consuming and a bit unprofessional if I ever forget. Plus other people might post stuff in the future. Is there anyway to do it automatically?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter revonline

    (@revonline)

    Anyone?

    The closest thing I could remember was this plugin…
    https://www.ads-software.com/support/topic/89683?replies=51

    Thread Starter revonline

    (@revonline)

    I’ll have a look.

    It seems like quite an easy thing to do in my head, just recognising an img tag and putting a link around it, but it must just not be something people need. And while it might sound easy in my head, I sure as hell don’t know where to start creating it myself!

    Two solutions:
    1) Put the IMG code in the excerpt box and use that on the main page. The you can also call up the excerpt in your posts so you don’t have to have the image code twice.

    2) not as nice but I actually do this for one site: make image thumbnails and name them with the number of the post ID. Then put something like <img src="https://www.mydomain.com/images/<?php the_ID(); ?>.jpg" alt="<?php the_title(); ?>" /> in your template. It’s sort of a pain making the thumbnail with this stupid ID name but it works great.

    Thread Starter revonline

    (@revonline)

    Hmm…I think you misinterpreted what I’m trying to do I’m afraid. Although that second solution is very clever.

    Anyway, I’ve already got the image appearing on the front page (it happens to be using the excerpt reloaded plugin, set to allow IMG tags through). What I want is the image to be a clickable link to the post, identical to the post title.

    If the image is uploaded through the post editor’s upload facility, my Post Image plugin may be of use:

    https://guff.szub.net/2006/02/09/post-image/

    If not (or you just want a more custom solution), see the following for other options:

    https://www.ads-software.com/support/topic/65180#post-346082

    Thread Starter revonline

    (@revonline)

    I was linking to outside images, but for no particular reason other than force of habit. I’ll give your plugin a spin (as it sounds like it does exactly what I want) and report back.

    Thread Starter revonline

    (@revonline)

    There’s good news and bad news. The good news is on my local test version of the site this works perfectly and does exactly what I want.

    Now I’ve come to put it online, it’s just not showing images. No error code, but no image either. I’m pretty sure I’ve got the same WordPress version on both, but I’ve seen mention of this not working properly with v2.1, which is definitely the version the online site is using.

    Any ideas?

    EDIT: And everything else is identical too – it’s even the same images.

    Hi RevOnline!

    Which hack/plugin did you tried to make it work (at least localy)?

    It would be nice if you post the solution here so that me & many others will have a try… maybe we’ll find a solution together.

    Thread Starter revonline

    (@revonline)

    Having a very slow and meticulous look through and a little bit of experimenting it seems it works perfectly if you only upload one image.

    Which is why it worked on my local version – I didn’t put the rest of the post behind the tests.

    So beyond that, I can’t help.

    Thread Starter revonline

    (@revonline)

    Any progress on this?

    Thread Starter revonline

    (@revonline)

    Progress.

    “The plugin wasn’t working with my 2.1 WordPress installation, but I just discovered that the problem is with my version of MySQL (5.0.18), which has a bug that causes the field “post_parent” in the posts table not be updated properly when a image is uploaded. For example, if I upload an image to the post with ID 19, the row that represents the image in the database should have the “post_parent” field equals to 19, but in my database it’s been recorded something like “-123881723″, so I have to update it by myself in order to the image display properly.”

    From Vinicius on the Post Image comments (from the link up a few posts). And he’s right – it’s an indenical problem on mine too. Going in, editing the error number and refreshing the homepage and the image appears as expected.

    Any chance of there being a fix for this? Luckilly in my case it’s not an epic task to change the number each time but it’s quite annoying.

    For everyone with the problem though at least there is a workaround now.

    barrybell

    (@barrybell)

    OK, here’s what I’ve done to fix this – and It hasn’t caused more problems than it’s solved (yet). ;o)

    Change line 278 of includes/post-functions.php from:

    $post_parent = (int) $post_parent;

    to:

    $post_parent = $post_parent;

    If anyone can see any knock-on issues with doing this, let me know. And if it does go wrong, feel free to blame my wife. Heh.

    Cheers.

    B

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Automatically making the first image of a post a link to the full post itself’ is closed to new replies.