If you only need to add a “lightbox” class to each element you just need to change this :
echo'<div class="mix '.$item_classes.'">'.get_the_post_thumbnail().'</div>';
to this :
echo'<div class="mix lightbox '.$item_classes.'">'.the_post_thumbnail('thumbnail', array('class' => 'lightbox')) .'</div>';
And if you want to add the full size image to be opened, try this :
$featured_img_url = get_the_post_thumbnail_url(get_the_ID(),'full');
echo'<div class="mix lightbox '.$item_classes.'"><a href="' . esc_url($featured_img_url) . '">' . the_post_thumbnail('thumbnail', array('class' => 'lightbox')) .'</a></div>';
check this for all the sizes available
Related Posts:
- How do you get the count of posts in an archive page?
- How to show Y number of custom posts after every X normal posts?
- Custom Post Type Pagination Not Working On Archive Page
- Archive page…limiting posts per page
- Adding custom post type to loop
- Pagination go to first page if i’m on last post
- Grossly inefficient wordpress loops!
- Order custom posts by taxonomy?
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- Taxonomy posts on Archive page
- How to show related posts by category or custom post type?
- Get the title of custom post type in another loop
- Posts navigation in custom post type single.php not working
- Display custom field of specific post where post title matches variable
- Remove duplicated values from a loop
- How to connect two custom post types with nested loops
- Pass the_post() as a parameter
- Normal pages as children of my Custom Post Type
- Custom Post Type Loop throws 500 error when used in widget
- Show one item per category of a custom post type
- Multiple Loops On Custom Post Type Template?
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Custom Tag Description unable to display just below and outside of the Loop
- Displaying CPT and custom taxonomy side by side in Bootstrap 4 component
- Group CPT posts by custom taxonomy
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- Display Custom Taxonomy Alphabetically
- Problem: wp_query outputs all images on site
- Pre-styling post content to display in lightbox
- Custom Post Type within the Loop on Homepage (Page Template)
- The loop seems stuck to a single (now deleted) post
- Custom Post Types strange pagination problem
- Display related custom taxonomy posts in sidebar
- Targeting custom post type
- Does WP have a global of $id?
- Conditional for a Single Post That Belongs to a Category?
- Bootstrap accordion looping through posts incorrectly
- Using wp_query to modify the loop in index.php for a CPT
- Custom WP_Query doesn’t display all posts
- Query & the_content() is showing in the header
- Listing custom post types on archive page with array
- looping though custom post types and only return results in a given taxonomy
- How to conditionally add Custom Post Type to Front Page
- Pagination not working on custom query on a page
- Search Filter CPT, Custom Loop
- Get post content from another section in custom single page
- Assign a template to a custom post type when displayed by the main loop on the home page
- Posts are not rendering perfectly [closed]
- Query all post types but limit to parents
- The loop does not show users
- Looping through custom taxonomy and display custom post types (Custom Post Type UI)
- Display only a single CPT
- Custom post class, generate unique id from 1 to x depending on amount of posts?
- Create a custom taxonomy template that loops through child categories in term order?
- Control Loop Within Loop
- Why is the output of a call to the_excerpt different when the call seems to be identical?
- Get post-meta value of all custom-posts – lowest to highest year-count?
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- Only looping through pages that have children or subpages
- How do I list a custom field and custom taxonomies for each result in a loop?
- Custom Post Type Query W/Category Dropdown
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- creating a foreign key like relationship with custom post types
- Show the categories the current post has
- On click some element i want to use some template
- How to Enable Ascending or Descending In WordPress Default Built-in Loop
- Fetch data from two custom post types and create multidimensional array for output to html table
- How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)
- How to display posts from a certain category in a bootstrap 5 carousel loop with multiple items?
- Loop all post on single.php
- Pin posts to top of custom loop
- Accessing download link from the loop with WP Download Manager Pro
- Custom WordPress theme not displaying posts from category
- Combine multiple separate lists into one
- Loop (for search results) returning right posts, but wrong post type
- custom post type single page
- How to prevent post to repeat on my loop?
- Custom post types not displaying per category
- Error in WP Query. If variable is empty it is displaying previous post value
- How to show Y number of custom posts after every X normal posts?
- Pagination in custom post type page template
- Load different template for CPT (in loop) in my plugin?
- How to loop custom post type posts by author?
- WordPress nested loop not working
- Order by custom field attribute
- Display Custom Taxonomy of custom post type
- Inserting random posts
- next_posts_link returns same content of 1st page
- Custom Loop and Standard Blog Loop Issue
- Custom loop won’t work, can’t find problem
- Categories and page filtering with pre_get_posts
- Loop through multiple custom taxonomy terms and display posts for a custom post type
- loop through custom post-type with two meta_keys
- Loop to pull content from parent element in custom post type [duplicate]
- How to exclude certain portfolios from a loop
- How to create custom page templates with default page layout framework?
- How to loop through a custom post type using a shortcode and output each element in the loop using shortcodes
- WPNavi pagination links not working on custom pages
- Where paramaters of a custom function are coming from inside the loop?
- Group search results by post type, but having a unique heading for each section?