You could try something like this, within your sidebar.php file:
if ( ! is_active_sidebar ('SIDEBAR-NAME-OR-ID' ) ) {
echo '<style>.main-content { width: 960px; }</style>';
}
This is hackish, but it should work for what you’re trying to do. There may be a better method but its hard to know without more context. The above code just spits out an inline style rule to full-width your .main-content wrapper if no widgets are present in the sidebar. The wrapper currently is set to 620px in your stylesheet (why it’s not full-width).
Related Posts:
- Stop WordPress Wrapping Images In A “P” Tag
- Stop WordPress automatically adding tags to post content
- Display Random Author with Details in Sidebar
- Strategy for handling hierarchical pages with empty parent content
- How to remove Nextpage tag inside posts text depending of utm_campaign
- Getting the Next and Previous Posts Titles in the Sidebar?
- How can you make sure authors’ posts are longer than 250 words?
- What is the best / efficient way to get WordPress content by post id and why?
- JSON not valid after json_encode posts
- Post X of Y in single.php / sidebar.php
- Add default content to post (for specific category)
- Programmatically inserting page breaks
- Hide parts of the post content on the home page
- Filter/Remove HTML Elements on all posts and pages
- Paragraphs removed when using get_post_custom()?
- Load post content into div with ajax
- Display all posts under child sub category in sidebar on post page?
- Load posts into sidebar and paginate via ajax?
- Testing for post title in ‘if/else’ statement returns no content
- How to show post(excerpt) from specific category on wp page?
- How to show video from specific category on sidebar?
- Same content shared between multiple posts?
- WordPress menu that shows all posts in a certain category like w3schools
- how load content as pop-up using ajax
- How can I hide the sidebar from a specific post?
- Batch process: remove first image from post content
- Sidebar links for different pages
- Show all posts in sidebar in single.php
- Why content_arr[‘extended’] removes paragraph tags?
- Get latest posts from WordPress site without header, menu and sidebar
- Post-ID in url differs from $post->ID
- Unautop / Sanitize content added to a post through a plugin
- is there a way to show the the post title after the image?
- How to get rid of shortcodes in post content once and for all
- Add Word Limit to Posts
- Can wordpress post and sidebar remain visible after scroll?
- Show only one page link in content pagination
- WordPress Sidebar menu for posts based on date – guidance needed
- Show only posts with images and a fixed amount of posts
- How to create new post content templates for my users?
- How do I do a page break?
- How to get a post’s content? [closed]
- 2 dynamic sidebars registered, not showing up
- Why does a published post only displays the title and not the content in the site? [closed]
- Sidebar show posts by current category also in single post
- Best Way to Add UnEditable HTML to Posts
- The_excerpt() doesn’t parse – how to change that?
- Page and post loop same template
- Benefits to using semantic HTML in post content? [closed]
- the_content() Not Grabbing All Content
- Display a post via template
- Can’t save WordPress post with “/etc/” in it
- Adding a meta box to determine the sidebar [closed]
- content summary of a post disappears If an images added at the beginning of the post. how to solve it?
- Sidebar on single.php not showing up
- Hide parts of the post content after typing it’s name or searching it by category
- Widget to show posts in the sidebar basing on its IDs
- Sidebar limiting to 10 posts?
- Preview page/post revisions without overwriting current content
- Getting post and attached image from subdomain
- Conditionally exclude post from specific category on home page sidebar?
- Posts and Pages w. private visibility don’t show up in existing content
- Show 10 latest posts only from users with contributors role
- Display most recent posts in category with Twenty Ten theme widget
- definining own teaser text for post
- Add text and change style to post programmatically depending on category
- why my urdu text is not aligned properly when written in wordpress blog post?
- How to Remove HTML Elements from Post Excerpt?
- My website is showing today’s date instead of published date since db migration to a new wordpress
- How can I create a ‘sub-blog’ which has its own sidebar on individual posts?
- Related post not showing table of content
- How to get unmodified post content?
- I have inserted a post’s content in homepage.php by the post-id. The font isn’t matching with the theme. How do I change font of this content?
- Single Sidebar; multiple templates! How?
- Posts on Sidebar only
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- Nothing appears using get_the_excerpt() in category.php
- WordPress each user has each content for a page,how to do that?
- Add caption to thumbnails in content
- Adding div to WordPress page content
- How to display most popular posts from certain category in sidebar?
- Adding editable content above posts
- How to get post_content while the post is being edited
- Custom template for different post types
- Multiple approval from editors before publishing?
- Same sidebar in all posts as in the category
- Get part of a page url
- How can i show only 30% of the “the_content(“More…”)”?
- How do I display the next 3 posts in the sidebar?
- How to use wp_editor(); in functions.php then retrieve content in the template
- Add default content to post (for specific category)
- jquery: getting contents of #content field on post page
- Stripping tag from elements in post
- get value from post to sidebar
- What does WordPress mean by they have full rights to content [closed]
- After the local installation of an old WP website I can see the homepage but I can’t access to the articles, why?
- wordpress pinboard theme [closed]
- Automatically search and replace link in content (pages/posts)?
- my website didn’t show the defult right sidebars
- Notify/check if the content of a custom gutenberg block has changed on save_post