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.
Related Posts:
- How to get post content by calling ajax?
- How to show all posts of the category in wordpress?
- Get the ID of the latest post
- Pull Two Posts Into Custom Post Type `single-cpt.php`
- Limit the post for differents custom post type in the same wp_query
- How to hook get_terms() to only show count of posts that have custom meta
- Loading post content in FancyBox
- Display “Post 2 of 4” on single post page?
- Query post types with multiple keys
- ascending order custom post type
- posts_nav_link on single post template
- Post Rank on Single Post page based on custom field
- Get all posts WHERE custom_field is LIKE value
- Quickest way to get last or oldest post date – WP Query
- Display only one post each WEEK
- List children on child post
- Get latest 3 posts from multiple CPT in one query
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Limit the post for differents custom post type in the same wp_query
- List all posts in taxonomy term
- Create a post automatically if search result has zero results
- minimize wp_query call to database
- Assign for all post of a post type a specific single-post template
- Use WP pagination functions on a custom page template
- update a posts of other custom post type
- How to get Last post Id of custom post type in wordpress
- query_post causes the posts to be loaded twice on load more posts
- Query Posts From Multiple Post Types
- WP Build-In Post selector for CPT
- How to make a list of posts displaying them 5 by 5 with a “next posts” link?
- Post URL redirecting to homepage
- Custom post type single-{custom}.php not working
- Add extra parameters after permalink?
- What is singular.php?
- Using meta_query, how can i filter by a custom field and order by another one?
- Limit the word count in the post title
- Correct Post Count ( All | Published | Drafts | Pending | Trash ) for Custom Post Type when restricting to view own posts
- How do I write this SQL statement for Posts written in last 24 hours?
- 960gs different classes on teasers posts
- Structuring a product catalogue in WordPress [closed]
- How can I fix a slow redirect after form submit from frontend (no plugin)?
- Query not returning CPT posts
- Change Post Title Edit Box
- Unable to display multiple post types in same query (WPML WP_Query)
- Multiple information using custom post type
- Disable feeds for specific custom post types
- Making pages also serve as taxonomies? Or give full pages to taxonomies?
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- Check Title Unique Or Not and If not error message and dont save
- I am having a problem with form updating/editing WordPress post on the frontend
- query_posts with a custom post type, a meta_query and sorting by post date?
- Combine query_posts() and get_posts() into single query
- Shortcode for display posts on home page show only one post
- How to Separate CPT From Regular Posts?
- Remove rows in the manage post/page view
- Remove single page for custom post type
- How to display Related Posts based on number of taxonomy terms matched
- Conditional for a Single Post That Belongs to a Category?
- $post not working working in AJAX plugin with custom post type
- Get term name without a foreach loop
- How to limit post per page of custom post type?
- Pagination not working on custom query on a page
- Query within a foreach within a query (queryception)
- How to implement a different permalink structure for custom post type?
- WordPress notification if new post published
- Restrict category access to specific users/groups. Author always has access
- Render a Post or Page using the correct file
- WordPress Count posts within a custom post type
- Copy/Move selected taxonomy terms to another taxonomy for posts
- Custom post type tags not showing in search
- HM CMB: Post Select Field for CPT ID
- 4 posts per page from single category
- Order Posts in Custom Order
- Why doesn’t wp_delete_post allow trashing for custom types?
- post type => ‘any’ not applied my custom queries
- Using Orderby and meta_value to order natural/alphanumerical
- Query the title of the page to show posts with matching category in the loop
- Post that populates itself (almost) automatically using data from imported excel file
- How to show data content from single page which is from custom post type?
- How to get adjacent_post custom_field value
- creating a custom post template
- Main site single-property.php design, as homepage of a multisite
- DIVs not showing correctly on CPT?
- Custom Post Type
- Popup panel is only displaying 1 entry ignoring all others
- Custom Post Status & Taxonomies
- How to Arrange Support => Thumbnail
- Custom post type single display is ommited
- Query Distinct Taxonomies of Custom Post Type
- Query child posts on parents single.php?
- is_singular won’t call my functions?
- Inserting two categories
- Get custom post type parent category
- How to exclude certain portfolios from a loop
- How to delete unnecessary custom post types in the UI
- Can I have a specific template for products even if they are standard posts and not CPT?
- Error 403 when posting comments to a custom post type from a different page
- Storing every individual update to the posts being updated over time?
- Change post structure
- How to automatically update ACF field value every year?