Title: Need help modifying code
Last modified: September 6, 2016

---

# Need help modifying code

 *  Resolved [jrcollins](https://wordpress.org/support/users/jrcollins/)
 * (@jrcollins)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/need-help-modifying-code/)
 * I’m using Widget Logic to stop a widget showing on parent category pages:
 *     ```
       $thiscat = get_category( get_query_var( 'cat' ) );
       $parent = $thiscat->category_parent;
       return
       !(is_category( ) && empty ($parent) );
       ```
   
 * I now want to add `!is_front_page()` to stop the widget from showing on the front
   page as well.
    I tried and failed using the following code:
 *     ```
       $thiscat = get_category( get_query_var( 'cat' ) );
       $parent = $thiscat->category_parent;
       return
       (!is_front_page( ) || !(is_category( ) && empty ($parent) ) );
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [jrcollins](https://wordpress.org/support/users/jrcollins/)
 * (@jrcollins)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/need-help-modifying-code/#post-8147072)
 * Ok, I think I’ve got it now:
 *     ```
       $thiscat = get_category( get_query_var( 'cat' ) );
       $parent = $thiscat->category_parent;
       return
       !(is_front_page( ) || (is_category( ) && empty ($parent) ) );
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Need help modifying code’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/widget-logic_c8dde5.svg)
 * [Widget Logic](https://wordpress.org/plugins/widget-logic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/widget-logic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/widget-logic/)
 * [Active Topics](https://wordpress.org/support/plugin/widget-logic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widget-logic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widget-logic/reviews/)

## Tags

 * [front page](https://wordpress.org/support/topic-tag/front-page/)

 * 1 reply
 * 1 participant
 * Last reply from: [jrcollins](https://wordpress.org/support/users/jrcollins/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/need-help-modifying-code/#post-8147072)
 * Status: resolved