• Resolved mjhaas

    (@mjhaas)


    Having resolved a problem with The Event Calendar in Customizr I thought I would share the result with the forum which has appeared in so many useful search results.

    With thumbnails for single posts turned on apparently random images were appearing in Event Calendar pages. It turns out that get_the_ID was returning 0 and consequently tc_get_id_from_attachment in class-content-post_thumbnails.php was returning an attachment to post 0. As zero seems to be the place holder for the parent id of unattached posts an unexpected image was being displayed.

    Presumably (I haven’t checked) get_the_ID returning 0 rather than false is due to some Event Calendar weirdness, I stopped looking once I came up with the following fix:

    add_filter('tc_use_attachement_as_thumb', 'not_when_get_the_id_zero');
    
    function not_when_get_the_id_zero( $bool ) {
        if ( get_the_ID() === 0 ) {
             return false;
        }
        return $bool;
    }

    The odd spelling of “attachment” in the hook name is the way it appears in the customizr code.

    I hope this helps someone else struggling with the same problem.

    Apologies if this has already been covered, I have only performed a desultory search of this forum.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Customizr and The Event Calendar random images’ is closed to new replies.