Why not use the body class to target these elements with CSS. You could do something like the following and make your PHP a little cleaner.
.product-item{width:33%;}
.home .product-item{width:25%;}
Related Posts:
- When is get_template_part() preferable to simply using the template.php files?
- Variable use in get_template_part
- Loading page content into a variable in template
- how could I load a different template part by page
- Only show content if current page is NOT one of 2 page templates [closed]
- Conditional get template part
- Does get_template_part() content gets parsed if it’s not executed?
- Get_template_part seems to be ignoring my template
- Blog template with different header to rest of site
- wordpress header leaks into body in a specific template
- Creating custom blog page template the right way
- How To Create A Paginated List Of All Categories On My Site?
- Password protected posts redirects
- Overriding page template using page_template filter
- How to consolidate multiple static page templates into one dynamic one?
- Capturing arbitrary semantic URL arguments
- How do I display the text inside the WP editor for a page with a custom template?
- How can I dynamically load another page template to provide an alternate layout of the posts?
- get url page template
- How to remove a parent theme template from Quick Edit?
- How to Set a Custom Template for Blog Posts
- Custom template for each page
- How can I have a static title on my blog page?
- page-slug goes to not found
- How do I add a body class to specific pages?
- How to list all titles of posts on a specific page?
- is_page_template not working as expected
- How to handle a missing page.php?
- Programatically switch page template?
- How to create a page template that retrieves content from db?
- Change path of the page’s template
- Get page id of current page from template [duplicate]
- is_page_template returning false
- get_pages — parent vs child_of?
- How do I style WordPress pages differently based on the tag used?
- How to pass outside function to WP_REST_Request
- Is there any way to get all the name or slug of template parts used in a page?
- page.php not displaying content
- Creating a custom archive template that sorts post by date
- WP-CLI not setting page template with page_template=”template-name.php”
- Create a page template with No Footer
- Register/Get sidebar?
- How to make text show up – new page template
- using the loop with a custom table
- Verify if the current page has at least one published child
- how to remove all body classes in wordpress
- Custom Post Type Archive template page not found
- Add #sidebar-2 to a custom page template
- What is wrong with my page.php?
- wp_redirect goes to infinity loop
- Single page Template for pages that begin with ‘confirmation-‘
- What content to use for inserting images
- Display one post in different formats conditionally
- Want to exclude slider from page.php in header
- get_avatar() as backround image
- get_the_excerpt() inside WP_Query – link URL Incorrect
- Change text size and color for tags and category meta description on product page
- Strip from the_tags() output
- How to make Dynamic Page Template based on Post ID’s
- add_rewrite_rule no longer working – possible https issue?
- Template Tag Does Not Work in Page Template
- Contact template doesnt appear in page template options
- Custom page template to sidebar/widget
- How to set custom cookies in WordPress after a form is filled on a page
- Proper way to create custom static page
- How can I correctly redirect user to the submitted post and define a template for each new post in WordPress?
- How to display all child/sub pages from all parent pages?
- RSS feed for a custom page template
- Subpage is redirecting to spam site
- How to integrate custom HTML template in a premium wordpress theme?
- How to load page template according to the Searched Page
- Set page template automatically according to parent slug
- Static page won’t identify template
- page_template filter without a plugin
- Add additional templates to the templates drop down on add page menu [duplicate]
- When to use content-pagename.php?
- Custom templates stopped working
- Single page theme: Can I render other pages with their respective themes within another page?
- How to set title from page-template?
- create template for one page
- How do you create a default template?
- Cannot display default template after switching to custom
- Custom Page Template not working when site moved from subfolder
- change the Theme dynamically
- WordPress & External Page: 404 error in IE and some others
- How can I set full width page layout in a default post page?
- E-Commerce Products Page Sidebar Formatting
- Lead Generation with Cookies in WordPress
- trying to add custom landing page to Twenty Eleven- can’t get rid of Twenty Eleven header/container? [duplicate]
- Template tag for /page/# structure
- Show tarifs page with menu a or b depending on menu of origin
- Fetching Image from other post/page with custom type
- How can I make different page templates for one category?
- Display child page on parent
- Utilizing the template hierarchy while storing page templates in a subdirectory
- Show page name in browser
- Animation as shown in the link
- Create Page with Template File from Plugin Folder
- I’m building a WordPress theme and noticed that the 404 page template runs along with the corresponding templates for each page. Any idea why?
- How do I update the SEO information on dynamic pages being generated from template_include?