retrieve custom post image through widget

Your calls to get_the_post_thumbnail do work, the problem is how what you’re doing with the result: <input type=”checkbox” name=”<?php echo $this->get_field_name( ‘photo’ ); ?>” value=”<?php echo esc_html(get_the_post_thumbnail( $post->ID, ‘thumbnail’ ) ) ?>” <?php checked( $instance[‘photo’], get_the_post_thumbnail( $post->ID, ‘thumbnail’ ) ); ?> > You can’t put image HTML tags inside of another tags attributes, that’s not … Read more

custom post type does not working when adding in child theme function

try to check you functions. That function might exist somewhere in your code. if you cant find it, then try to remove the if statement and just add your function directly like this function testimonial() { register_post_type( ‘testimonial’, array( ‘labels’ => array( ‘name’ => ‘Testimonial’, ‘singular_name’ => ‘Testimonial’, ‘add_new’ => ‘Add New’, ‘add_new_item’ => ‘Add … Read more

How to set class to “current-page” on the currently viewed single post within a CPT

I figured it out. Before the declaration of $case_query, I declare the active page id, like so: $active_page = get_the_ID();. Then, in the while loop after the_post(); I add the following: $activeclass=””; if (get_the_ID() === $active_page) { $activeclass=”current-page”; } I also add the $activeclass to the .case-list-item div: <div class=”case-list-item <?php echo $activeclass; ?>”> Solved.