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)
- How to create a list of links to post with specific category
- Page of posts made to look like homepage
- post/page content
- Link to older links
- How to link post titles on page A to its posts on page B?
- WordPress Architecture as a CMS – Posts & Pages
- How to list post as buch of category, and all of them
- Is it to possible to insert a page in the post depending on the category ofthe post
- Organization of time insensitive content
- latest post showing up twice on posts page
- wp_list_categories() Exclude All Categories Except One
- Direct some posts to only appear on a specific page
- Adding if statement into the_content()
- How to show next/prev link, when it’s not active?
- Defining ‘last’ class on foreach blog posts
- Archieve page, Advertisement Every 3 Posts
- Prevent 404 of Author pages without posts
- Highlighting Current Category in the Archive and Feeds page
- Categories Listing and Highlighting current category item
- Prevent duplicate pages from being added
- Can I style single post that are in multiple catergories?
- Geting error in post and category [closed]
- How to show full post on home page
- Display most recent posts in category with Twenty Ten theme widget
- What would causes search to return incorrect results?