• Resolved John

    (@dsl225)


    Hello,

    I use a directory theme that has custom post types called “listings” and I also have regular posts for news.
    What’s strange is that your plugin works fine (=displays the default image properly) for the custom post types – where it’s not really needed because images are mandatory here – and doesn’t work for regular posts.. I was rather expecting I would encounter an issue the other way around and I’m surprised to see this happen that way.

    This is what I get with regular posts:
    https://tinypic.com/r/2vd49l3/8

    Notice the 3 characters at the bottom right of the missing picture.

    Any clues?

    Thanks.

    https://www.ads-software.com/plugins/default-featured-image/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Jan-Willem

    (@janwoostendorp)

    Hello John,

    This is weird indeed. It is an html error. Is there a weird character in the image file name?
    Have you tried disabling other plugins?

    Can you copy the HTML of that part? (ctrl+U, not from the inspector)
    I’m curious to see what this problem is.

    Thread Starter John

    (@dsl225)

    Hi Jan,

    Many thanks for your feedback.
    I double-checked with a dev version of the site running without any plugins and the result is the same:

    HTML for a listing (working):
    <div class="listing_img"><a href="https://domain.com/city/whatever/listing/test/" ><img width="331" height="228" src="https://domain.com/wp-content/uploads/2014/12/noimage.png" class="attachment-directory-listing-image default-featured-img" alt="noimage" /></a></div>

    HTML for a news post (not working):
    <a href="https://domain.com/blog/test/" title="Test" rel="bookmark" class="featured-image-link"><img src="<img width="240" height="165" src="https://domain.com/wp-content/uploads/2014/12/noimage.png" class="attachment-thumb default-featured-img" alt="noimage" />"/></a>

    The only difference with a “normal” site is that this one runs on a Multisite installation but I can’t see how this may have any incidence here.

    If you can provide here an email address, I may send you the site’s link; otherwise I’ll give you one disposable where you may send an initial message and then I’ll reply back from my own address.

    Plugin Author Jan-Willem

    (@janwoostendorp)

    The HTML gives me enough.
    Is it a free theme that I can see download to check myself?
    I think something is wrong with the theme but I’m not sure.
    The way the featured images are fetched in news has to be different. It micht be in the template. It might be in the functions.php or somewhere else. It’s hard to guess.

    If it’s paid you can send me a zip to [my username]@gmail.com

    Thread Starter John

    (@dsl225)

    Yes, right, it’s a paid one.
    Will follow-up by email, many thanks!

    Plugin Author Jan-Willem

    (@janwoostendorp)

    Hi John,

    I looked at the themes and the fault is somewhere in get_the_image() function. It’s a big function, I don’t know where is is going wrong. I suggest overruling the content-blog.php file and swithing the get_the_image() with one of the default WordPress functions which should work wit my plugin.

    Thread Starter John

    (@dsl225)

    Thanks for looking into this.
    But how would this suggestion be possible?
    I mean how to overrule this file?

    Plugin Author Jan-Willem

    (@janwoostendorp)

    I don’t know you level of skill. But this does require some coding.

    Copy content-blog.php from the directory to the yellowpages there do the edits you need.

    Then replace (line 34ish)

    <a href="<?php echo get_permalink(); ?>" title="<?php the_title_attribute( 'echo=1' ); ?>" rel="bookmark" class="featured-image-link"><img src="<?php get_the_image( array( 'size' => 'thumb', 'link_to_post' => false ) ); ?>"/></a>

    with;

    <?php /*<a href="<?php echo get_permalink(); ?>" title="<?php the_title_attribute( 'echo=1' ); ?>" rel="bookmark" class="featured-image-link"><img src="<?php get_the_image( array( 'size' => 'thumb', 'link_to_post' => false ) ); ?>"/></a>*/ ?>
            <a href="<?php echo get_permalink(); ?>" title="<?php the_title_attribute( 'echo=1' ); ?>" rel="bookmark" class="featured-image-link"><?php echo get_the_post_thumbnail( get_the_ID(), 'thumb'); ?></a>

    Not tested. But it should work

    Thread Starter John

    (@dsl225)

    Brilliant!

    That works like a charm!
    Thanks a lot for your kind assistance.

    Plugin Author Jan-Willem

    (@janwoostendorp)

    Good to hear.
    Do keep in mind that I don’t know where else it can effect your pages.
    Maybe it’s good but I can’t see/know.

    Thread Starter John

    (@dsl225)

    No problem, I’ll keep an eye on this.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Works only partly for me…’ is closed to new replies.