You can use conditional tags or function wc_get_page_id('page_name')
, where page_name
can be: ‘myaccount‘, ‘shop‘, ‘cart‘, ‘checkout‘, etc.
For example:
Using is_cart()
you can check whether the current page is a cart page.
Using wc_get_page_id( 'cart' );
you will receive ID of cart page.
Which way is more suitable for your code you have to decide for yourself. Some conditional tags ( like is_checkout()
, is_cart()
) are based on wc_get_page_id()
.
Related Posts:
- posts going to 2 pages/categories only show up in 1
- Display all posts from specific categories on a page
- How to show list of posts by author and category?
- Why do I need to use The Loop on pages (inside page.php etc)?
- Create custom page in WooCommerce
- posts page – different lengths of excerpt
- Remove child products from woocommerce category page [closed]
- Multiple loops in same page, without duplicate content
- Can I hide a specific post from latest posts page?
- How to show post(excerpt) from specific category on wp page?
- Divide Loop Into Days & Categories
- Differentiate between posts and pages in search results
- How to filter posts that belong to a specific category only if that is the only category
- page.php showing loop of posts and not page content
- Can I divide the pages into categories?
- Display post category in foreach loop with category link
- Child_of not displaying all children posts.. via get_posts
- Multiple loops are not reset
- Should I use posts or pages in this scenario?
- post categories
- Exclude category from
- Pulling in post category and children within category
- Post categories to pages
- Listing Specific Categories from Current Post with Depth
- How to make the first post in the loop be styled like a “new / featured” post?
- How do I stop the loop from repeating in my category template?
- get_the_category listing in hierarchial order
- Display Posts on Custom Page
- why does wordpress ignore the post args?
- Multiple Loops Breaking Pages
- Showing categories and subcategories with posts
- WordPress Query Posts From Category Post on Static Page
- How to create a “latest news” page showing a list of posts from blog category
- Having pages after specifying post_type post
- Are post, page and category IDs unique to each other?
- WP_Query of Category Not Showing First Post
- Get post category as a separate string and url
- Pagination for normal (standard) posts on a page with a custom loop?
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- How can I add a page that shows posts from a single category?
- Get current taxonomy and display query accordingly
- Different post views for different category views
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Automatic duplicate/copy of post to a related page in WordPress
- Get category slug of the Parent category of a Product
- Yoast breadcrumb URL shows category instead of the page
- Current post categories and subcatecories outside of the loop
- How to add a block to a category page?
- Show code only on WooCommerce Pages
- Page with Category Returning 1
- How to show category image if no featured image is set?
- Post Category link is same with Page link
- Display new posts categories in separated divs
- How do I make it so that new posts within a certain category go into a certain page?
- Posts are not showing up on next page.
- Precedence of page permalinks over woocommerce product category links?
- List Authors For Current Category
- Show only top 3 posts from 3 categories in order on home page
- Multiple Post Repeat for Related Post Loop by Category
- Show post if in category
- Displaying categories items among posts
- Make assigning post to a specific category equivalent to assigning it to all categories
- Displaying only posts from a certain category on my custom page template
- I need to create a page or post hierarchy
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- how to style an individual page in a category [duplicate]
- The loop: more posts than I want to fit on one page
- Redirecting posts in WordPress to a specific page
- Woocommerce – custom post type of checkout page
- Show all posts in category
- When and how will php code in a user made WordPress page be executed?
- CSS – Change height of Storefront / WooCommerce product categories, but not products
- What function does the loop of displaying posts?
- wordpress category Description not allowed tag
- View post with specific category id and name which I selected in the backend (drop-down option)
- Difference between an archive and a page listing posts
- Can’t show comments count per post outside loop
- How to Add ‘Post Categories’ to the Dashboard Sidebar
- Insert woocommerce products programmatically with featured image and gallery
- If in_category not working for multiple single.php pages
- How show categories in admin and get that selected to show posts in index
- Custom Permalink Structure for Pages & Posts
- Getting a “404 Not Found” error when “Preview Changes” is clicked
- Display selected categories onto post page
- Post/page title to permalink transformation – what is behind the scenes?
- Would a “hub” page work better as a page or a post?
- Some doubts about how the loop work (trying debugging it)
- How to view all posts (on site, not admin) that are uncategorized?
- How to show full post on home page
- Can I Paginate Post after every 25 tag?
- How to show posts ordered by random [duplicate]
- Query posts from newest category
- WordPress loop uses unmodified posts array, why?
- Ajax – Post Categories and Load More
- Skip posts, but keep posts per page
- How to organise post by category and date
- How to display custom content in post with category XXX
- Display ONLY Latest Post From Several Categories
- how to show all type of author posts in author page (SOLVED)
- WordPress Page Column Problem [closed]