Title: Hide some DIV
Last modified: June 10, 2021

---

# Hide some DIV

 *  Resolved [vishnua](https://wordpress.org/support/users/vishnua/)
 * (@vishnua)
 * [5 years ago](https://wordpress.org/support/topic/hide-some-div/)
 * Need to hide / Disable some of the div used in by theme.
    is there any option
   to add a class to the specific div’s so that it will disable in the AMP version
   only?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhide-some-div%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [5 years ago](https://wordpress.org/support/topic/hide-some-div/#post-14541717)
 * Hello [@vishnua](https://wordpress.org/support/users/vishnua/)
 * If you are able to edit theme code I will recommend using the [amp_is_request()](https://amp-wp.org/reference/function/amp_is_request/)
   function.
 * example :
 *     ```
       // If it's not AMP page display the div.
       if ( function_exists( 'amp_is_request' ) && ! amp_is_request() ) {
            ?>
               <div class="show-on-normal-site">Display this div only on non-AMP page.</div>
            <?php
       }
       ```
   
 * if you are non-dev you can also hide a div using CSS specification html[amp]
 * eg:
 *     ```
       html[amp] .hide-this-div-on-amp {
          display:none;
       }
       ```
   
 * Hope this helps!
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [5 years ago](https://wordpress.org/support/topic/hide-some-div/#post-14543246)
 * The logic condition may make more sense as: `! function_exists( 'amp_is_request')
   || ! amp_is_request()` so that the non-AMP code is served when the AMP plugin
   is deactivated.
 *  Thread Starter [vishnua](https://wordpress.org/support/users/vishnua/)
 * (@vishnua)
 * [4 years, 12 months ago](https://wordpress.org/support/topic/hide-some-div/#post-14544389)
 * Thanks, [@milindmore22](https://wordpress.org/support/users/milindmore22/) and
   [@westonruter](https://wordpress.org/support/users/westonruter/) have tried amp_is_request
   function but it breaks theme, so have switched to CSS div option and it worked.
 * have a class
    `<div class="top_scroll row>` which is needed to hide can you give
   the full code with `amp_is_request()`
 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [4 years, 12 months ago](https://wordpress.org/support/topic/hide-some-div/#post-14545210)
 * Hello [@vishnua](https://wordpress.org/support/users/vishnua/)
 * Please try the following code.
 *     ```
       if ( ! function_exists( 'amp_is_request' ) || ( function_exists( 'amp_is_request' ) && ! amp_is_request() ) ) {
       	?>
       	<div class="top_scroll row>
                  <!-- Your content here -->
       	</div>	 
       	<?php
       }
       ```
   
 * In meantime, I will work on a mini plugin that might help you remove element 
   with the class
 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [4 years, 12 months ago](https://wordpress.org/support/topic/hide-some-div/#post-14545626)
 * Hello [@vishnua](https://wordpress.org/support/users/vishnua/)
 * Please download and install [this mini plugin](https://github.com/milindmore22/amp-hide),
   once you install it use `noamphtml` class anywhere to hide any element
 * eg:
 *     ```
       <div class="top_scroll row noamphtml">
                  <!-- Your content here -->
       </div>
       ```
   
 * **OR**
 * You can use the mini plugin’s filter to add your own classes
 * eg: add the code below in your themes functions.php or in a custom plugin (the
   code will only work with mini plugin)
 *     ```
       add_filter(
       	'amp_hide_classes',
       	function( $classes ) {
       		$classes[] = 'top_scroll';
       		return $classes;
       	}
       );
       ```
   
 * Hope this helps!
 *  [Bethany Chobanian Lang](https://wordpress.org/support/users/mxbclang/)
 * (@mxbclang)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/hide-some-div/#post-14579218)
 * [@vishnua](https://wordpress.org/support/users/vishnua/) As we haven’t received
   a response, I’ll mark this as resolved. Feel free to open a [new support topic](https://wordpress.org/support/plugin/amp/#new-post)
   if you continue to encounter issues, or reopen this topic and we’d be happy to
   assist. Thank you!

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

The topic ‘Hide some DIV’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

 * 6 replies
 * 4 participants
 * Last reply from: [Bethany Chobanian Lang](https://wordpress.org/support/users/mxbclang/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/hide-some-div/#post-14579218)
 * Status: resolved