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?
- Restrict custom post type to only site administrator role
- How to force one column layout on custom post type edit page?
- WordPress REST Create Post of Custom Type
- Loading Custom Post Type Events into jQuery-based FullCalendar?
- order by meta_value serialized array
- Assigning a role to a specific custom post type (and ignoring other post types)
- Display posts in random post types
- Multiple templates for custom post type
- How to make an archive page displaying posts in a date range
- IF statement in a do_shortcode
- Slug for standard post post_type
- Make `previous_post_link()` Function Show The Post After Next i.e. Jump A Post
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- Remove parent from custom post type
- Multiple post type queries (with specific arguments for each)
- pagination redirecting from page number url before page requested
- How to add post_type=value when editing that post type in the WordPress admin?
- Open Custom Post Type as PDF
- How to use custom taxonomies to reference complex relationships?
- Allow non-logged in users to see a future post after clicking on a list of future posts
- Update Post Meta for a logged in user
- How to edit this code to get the categories in achieve page?
- Get the category from custom post type
- Is it possible to store Custom Post Type data in separate set of tables and still have wp_post class functionality?
- Prioritize posts in query by meta keys?
- How to show only the most recent post on my custom post type archive?
- Loop for custom post types filtered by a taxonomy
- Is it a good idea to add a column to the posts table?
- Display Only Certain Category In a Custom Page Template
- Querying multiple values from a single key
- Creating separate feeds for custom post types
- hide specific div on single.php [closed]
- How to use single.php for creating, reading and editing Custom Posts with ACF
- Can’t change posts per page in WordPress Post Type Query
- Easy reading or transfer of data from posts?
- list posts of two post types in a single template
- The loop does not show users
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Front-end Image Upload to Custom Meta Box
- Create a custom post type based on ‘Post’
- Conflict in function to allow single post template based on category
- Find Posts based on Child Post value
- Showing only posts from the current user who is logged in?
- Invalid content when I try to import custom post type from the old template wordpress
- Add a form in every post and save data in post meta
- How to set post date in post_type so that it’s same as latest post in category
- Right way to store a large set of similar information on website? [duplicate]
- Custom post type single page 404
- Correct way adding External classes to Custom Post type and output their methods to template
- Posts per Page on custom Taxonomy Template
- Assign a Post to a User
- Cannot save pages after migration
- Bulk trashing post ‘fails’
- Rest Api not working with Iframe in form data
- Why custom post redirecting to index page?
- Getting Custom Posts with Custom Taxonomy
- Limit or filter edit view in the dashboard to a specific ID only?
- How do I get the posts from single page custom post type from a sidebar to display in a page?
- How to add New Post On clicking a button?
- Getting wrong ID
- How to make post page unique and show it on home page?
- how to load custom single.php?
- Ordering custom post type by custom field without a title
- How to apply order on custom taxonomy and custom meta key on custom post type
- How to hide home title on pages and posts?
- show custom post’s post in two different divs [duplicate]
- Front end post or photo or both
- How to make a non-public post on wordpress approval?
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- How Do I Add a Custom Post Type URL to Content?