Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Montezuma Theme (http://forum.bytesforall.com/forumdisplay.php?f=53)
-   -   Post thumbnails no longer linking to posts (http://forum.bytesforall.com/showthread.php?t=23818)

poorboy Dec 8, 2016 06:06 PM

Post thumbnails no longer linking to posts
 
I upgraded to Wordpress 4.7 and now the thumbnails of my posts no longer link to the posts

Where as in the past I would see this in the code:

Code:

<div class="thumb-shadow"><div class="post-thumb"><a href="/post-url/"><img src="banner.png" width="740" height="253" alt="post title"/></a></div></div>
Now the /post-url/ part is blank like so:

Code:

<div class="thumb-shadow"><div class="post-thumb"><a href=""><img src="banner.png" width="731" height="286" alt="post title"/></a></div></div>
I see in postformat.php that this is the code

Code:

        <h2>
                <span class="post-format"></span>
                <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a>
        </h2>

        <?php bfa_thumb( 620, 180, true, '<div class="thumb-shadow"><div class="post-thumb">', '</div></div>' ); ?>

And that in Montezuma: thumb.php (includes/thumb.php):

Code:

        if( trim( $this_thumb ) != '' AND $this_thumb != FALSE ) {
                if( $link == 'permalink' )
                        $this_thumb = '<a href="'.get_permalink( $id ).'">'.$this_thumb.'</a>';       
                echo $before . $this_thumb . $after;

I'm not sure what changed, or how to fix it.. any help?

CrouchingBruin Dec 8, 2016 08:37 PM

I'm seeing the same thing on my test site, the href attribute for the thumbnail's anchor tag is empty, although the post title's link is OK. Good thing I haven't updated one of my production sites to WP 4.7 yet. Thanks for the heads up, I'm going to hold off on upgrading until there's a fix.

CrouchingBruin Dec 8, 2016 11:35 PM

I've come up with a temporary workaround until the code is fixed.

At first, I tried surrounding the call to bfa_thumb() with an anchor tag that calls the_permalink:
Code:

<a href="<?php the_permalink(); ?>">
<?php bfa_thumb( 620, 180, true, '<div class="thumb-shadow"><div class="post-thumb">', '</div></div>'); ?>
</a>

This did not work, because bfa_thumb() outputs an anchor tag of its own, and you cannot nest anchor tags (it's syntactically incorrect).

So then I looked at the documentation for bfa_thumb, and it says that the last argument in the function is $link, and the default value for $link is permalink, which is supposed to indicate that an anchor tag that points to the post is to be output. If you pass in an empty string for $link though, the function won't output an anchor tag, and adding an enclosing anchor tag (with a call to the_permalink) will work:
Code:

<a href="<?php the_permalink(); ?>">
<?php bfa_thumb( 620, 180, true, '<div class="thumb-shadow"><div class="post-thumb">', '</div></div>', ''); ?>
</a>

So this snippet is just like the above one, except there's an empty string added as the last argument for the bfa_thumb() function to prevent it from outputting the anchor tag.

poorboy Dec 9, 2016 02:29 AM

Quote:

Originally Posted by CrouchingBruin (Post 114629)
Code:

<a href="<?php the_permalink(); ?>">
<?php bfa_thumb( 620, 180, true, '<div class="thumb-shadow"><div class="post-thumb">', '</div></div>', ''); ?>
</a>


When I try your temp fix, it pops some of the thumbnails out of the smaller box and makes them not fit neatly

If I recall correctly, this was an issue with Montezuma years ago that required a fix of some kind

juggledad Dec 9, 2016 11:50 AM

@poorboy and/or @CrouchingBruin:
Can you do an export of yout Montezuma settings and attach them to a reply. I haven't been able to cause the issue yet.

NEVER MIND now I have it occurring

juggledad Dec 9, 2016 12:24 PM

see Patch 128-02: Fix issue where thumbnails don't link to post after upgrading to WP 4.7 for the solution

poorboy Dec 9, 2016 12:53 PM

Quote:

Originally Posted by juggledad (Post 114632)
or replace the current montezuma/includes/thumb.php with the attached version - after unzipping it

Works, thanks <3

CrouchingBruin Dec 10, 2016 11:48 PM

Yes, works for me, too. Thanks!


All times are GMT -6. The time now is 12:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.