Featured image on pages

Posted in: Newspaper
Post count: 17

I want to show featured images on pages, like on posts. I managed this by using the following code in the page.php file:


<div class="td-page-content">
    <?php
        if ( has_post_thumbnail() ) { 
            $thumb_id = get_post_thumbnail_id();
            $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
            $thumb_url = $thumb_url_array[0];					
                                                    
            $thumb_id = get_post_thumbnail_id();
            $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
            $thumb_url = $thumb_url_array[0];
            ?>
            <div class="td-post-featured-image">
                <a>">
                    <img width="696px" height="auto" />" alt="<?php the_title() ?>" title="<?php the_title() ?>" />
                </a>
            </div>
        <?php }
        the_content();
endwhile;//end loop    
}
?>
</div>

The image shows allright, but the modal function doesn’t work. What do I need to change or add to use the modal function?

And if you have any improvements on the code above, please let me know. I am not a coder, although I can copy, paste and tweak a bit as you can see. But it probably isn’t optimal.

Post count: 17

I noticed I put 3 lines twice in the code block above. Sorry about that. I cannot edit the post anymore.

Anyway, I managed to create a workaround. I installed a plugin called “Lightbox Responsive Images”, and added this code to the page.php file, right before “the_content();”


if ( has_post_thumbnail() ) { 
         $thumb_id = get_post_thumbnail_id();
         $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
         $thumb_url = $thumb_url_array[0];
         ?>
         <div class="lightbox_featured-image">
               <a href="<?php echo $thumb_url ?>">
                   <img src="<?php echo $thumb_url ?>" alt="<?php the_title() ?>" title="<?php the_title() ?>" />
               </a>
          </div>
<?php }

The class “lightbox_featured-image” must be set in the plugin settings. Works like charm. The plugin lightbox looks and behaves a bit differently than the modal window from the theme, but it’s good enough for now. And it doesn’t interfere with the theme’s modal function.

Still, I hope you guys add the modal window feature to page images as well, in a future update.

Post count: 23312

Hello argosmedia,

We certainly plan to extend the theme flexibility in the future updates. I’ve added your suggestion on our list and when the time comes our developers will consider it. This may take some time because we have a long implementation list and we take them one by one. Thanks for your suggestion, have a nice day.

Thanks for your understanding!

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newspaper’ is closed to new topics and replies.