I don’t know if I understand you correctly, but probably in the file which calls get_sidebar()
:
You could do something like
if ( ! is_home() ) {
get_sidebar();
}
Or in your header.php where the main-element starts (which probably wraps the sidebar). You could give it a class if the page is not the home page:
<!-- body and header-stuff -->
<main class="<?php echo is_home() ? 'home-without-sidebar' : 'with-sidebar'; ?>">
<!-- other stuff -->
<?php
if ( ! is_home() ) {
get_sidebar();
}
?>
And then define CSS accordingly:
.home-without-sidebar {
/* whatever properties */
}
.with-sidebar {
display: grid;
grid-template-columns: 20rem 1fr;
/* more properties here */
}
Related Posts:
- Is having multiple theme customizers for different pages possible?
- How to export/import theme customizer settings?
- reason of splitting theme files to multiple files
- How to get the registered sidebar’s name by its id?
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- One button to change all settings in theme customizer?
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- How to use copy() function and paste file in /wp-content/themes directory
- Design view breaking on Pages
- Use different javascript files for each page on website
- How to get custom image size for image uploaded in Customizer
- Passing array in add_option()
- do not show web page section when using advanced custom fields pro
- Widgets not showing in my custom theme
- Am I not understanding plugins?
- Using Font Awesome as post thumbnail
- Why WordPress architecture is not pure object oriented and it don’t use MVC pattern? [closed]
- How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)
- Changing the template hierarchy
- custom shortcode will not display the wrapped content
- Can’t load WP function into external function
- Set WordPress Default Template
- Customizer: Output default value in Customizer CSS
- WordPress does not load page.php, return 404.php
- How can i upload images in an admin page?
- Hide categories that are not used in the post type
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again
- what is the best practice to add new field to an api route
- Improve page speed loading using CDN and async or defer attribute
- Customizer: active_callback and sanitize_callback incompatibility?
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- How do I link a button I created in theme customizer to a function?
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- What does this mean in wordpress? Easy question
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- Reason to add a name of the theme like (‘menu-1’ => __( ‘Primary’, ‘twentynineteen’ ),) in PHP?
- Separation of presentation and code – WordPress
- WordPress Customizer Default Image
- zip unzip attachments in wordpress
- Why in my theme I can’t see all the statics content under the posts?
- get_template_directory adding FTP root folders in urls
- Header not properly displaying on archive.php
- Save Custom CSS file in the upload folder dynamically?
- Warning: printf(): Too few arguments in helpers.php file
- Validate and Sanitize WP REST API Request using WP JSON Schema?
- home.php show blog posts as grid view
- How to Update an old theme for the latest wordpress version
- How can I search all plugins for composer’s vendor/autoload.php?
- get_comments_number() returns 0
- Removed jQuery script from header.php , any problems?
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- Why in this WordPress theme I can’t see the Main Menu?
- How can I assign separate stylesheets to different pages?
- How to make sure relative URL works when site is not on root domain?
- Toolbar Hidden in a Virtual Page
- Commas in Tag Cloud
- WordPress redirects page query parameter in URL
- Dynamically switch file in get_template_directory_uri() | Function [closed]
- Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given
- How to extend SelectControl with data from my theme
- How to change basename url for wp-admin?
- Not able to remove caption shortcode from the content
- When I click for the redirect link it is showing the content of index.php instead of single_assignment_page.php
- Unable to retrieve get_author_posts_url
- Display post date also if the date it’s the same for each post
- Submit remote form to wordpress REST API and save data to custom post type
- How to override theme’s public static function inside of a trait?
- Store user form submitted information in post type
- Display attached images of a page or post that are insetred using gallery
- Add a custom link to each image in WordPress gallery
- register dependency css and js inside a plugin class
- WordPress child theme, creating a custom php template page
- Menu to the right of screen on desktop using Bootstrap 4
- How to properly escape in ternary operators – Wp Coding Standards?
- How to add Open/Close Toggle button into Twenty Fifteen theme for hiding left sidebar?
- Use Custiomizer to setup meta theme color tag
- Rotating Header Images
- Create a custom theme-specific page, invisible in the admin-panel?
- WP Knowledge Base Theme bug – Subcategories and Articles, Need to change WP_Query
- Image not displayed
- WP multisite network plugin fails to see classes loaded with spl autoload
- How to edit the default database of WordPress [closed]
- Predefine Magazine Style Layouts
- How to store the_post_thumbnail() value in a variable
- Variable ++ in query loop
- Woocommerce Convert existing order to the cart
- Font Awesome Icons as squares [closed]
- Plugin development and composer
- Removing “Powered by” footer using child theme PHP [closed]
- custom post type with role Vendor
- url not using query string no longer working
- How to identify which php file a plugin is using on page load?
- How can I customize a WordPress theme before it’s downloaded?
- WordPress rewrite question
- Using Nonce for my Form
- Shortcode working in page.php but not in category.php in wordpress
- How can a ‘scripts’ directory be hooked into wp_head();?