Title: Two topics
Last modified: January 17, 2020

---

# Two topics

 *  Resolved [callaloo](https://wordpress.org/support/users/callaloo/)
 * (@callaloo)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/exclude-error-page-from-css/)
 * 1. The post and page have something like `body:not(single-post):not(.page)`. 
   How about error404 page? I was styling the blog and archives pages and it is 
   affecting error404 page, making me write custom CSS for `.error404` to correct
   it.
    2. How do I assign this as widget title to a shortcode hooked after the 
   right sidebar content? `<div class="widget-title">Widget Title</div>` Here is
   the function
 *     ```
       add_action( 'generate_after_right_sidebar_content', 'gp_side_comments_box');
       function gp_side_comments_box() {
           if (! is_single() || (! is_page) ) {
               echo do_shortcode( '[comments-widget]' );
          }
       }
       ```
   

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [callaloo](https://wordpress.org/support/users/callaloo/)
 * (@callaloo)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/exclude-error-page-from-css/#post-12337881)
 * Also, using this code does not work to hide content on posts and pages. It only
   works when one of them is used, that is, `! is_single()` or `! is_page`.
 *     ```
       add_action( 'generate_after_right_sidebar_content', 'gp_side_comments_box');
       function gp_side_comments_box() {
           if (! is_single() || (! is_page) ) {
               echo do_shortcode( '[comments-widget]' );
          }
       }
       ```
   
 *  Theme Author [Tom](https://wordpress.org/support/users/edge22/)
 * (@edge22)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/exclude-error-page-from-css/#post-12338407)
 * Hi there,
 * 1. The 404 page has this class you can target: `error404`
 * You might be able to do this:
 * `body:not(single-post):not(.page):not(.error404)`
 * 2. Would this work?:
 *     ```
       add_action( 'generate_after_right_sidebar_content', 'gp_side_comments_box');
       function gp_side_comments_box() {
           if (! is_single() || (! is_page) ) {
               echo '<div class="widget-title">Widget Title</div>';
               echo do_shortcode( '[comments-widget]' );
          }
       }
       ```
   
 * 3. When exactly are you wanting the widgets to display? On archives only? If 
   so, try `is_archive()`
 *  Thread Starter [callaloo](https://wordpress.org/support/users/callaloo/)
 * (@callaloo)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/exclude-error-page-from-css/#post-12340610)
 * 1. Thanks. It worked.
    3. On the homepage and archive pages but avoid single 
   post, page and error page. I found using `! is_singular()` works too, but not
   on the error page. If you have a better solution, I wouldn’t mind.
 *  Theme Author [Tom](https://wordpress.org/support/users/edge22/)
 * (@edge22)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/exclude-error-page-from-css/#post-12341816)
 * Try this:
 *     ```
       if ( is_archive() || is_front_page() ) {
   
       }
       ```
   
 *  Thread Starter [callaloo](https://wordpress.org/support/users/callaloo/)
 * (@callaloo)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/exclude-error-page-from-css/#post-12343274)
 * It worked too. Thanks.
 *  Theme Author [Tom](https://wordpress.org/support/users/edge22/)
 * (@edge22)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/exclude-error-page-from-css/#post-12345494)
 * You’re welcome 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Two topics’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/generatepress/3.6.1/screenshot.
   png)
 * GeneratePress
 * [Support Threads](https://wordpress.org/support/theme/generatepress/)
 * [Active Topics](https://wordpress.org/support/theme/generatepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/generatepress/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/generatepress/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Tom](https://wordpress.org/support/users/edge22/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/exclude-error-page-from-css/#post-12345494)
 * Status: resolved