Title: conditionally display after_widget code?
Last modified: August 19, 2016

---

# conditionally display after_widget code?

 *  Resolved [stereozeitgeist](https://wordpress.org/support/users/stereozeitgeist/)
 * (@stereozeitgeist)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/conditionally-display-after_widget-code/)
 * So currently I have a sidebar that’s set up like this:
 * if ( function_exists(‘register_sidebar’) )
    { register_sidebar(array( ‘before_widget’
   => ‘<div id=”%1$s” class=”widget %2$s”><div class=”inside”>’, ‘after_widget’ 
   => ‘<div class=”more”>+ More</div></div>/div>’, ‘before_title’ => ‘<h3>’, ‘after_title’
   => ‘</h3>’, )); }
 * but I’ve got the idea that I’ll exclude the <more> div on one of my sidebars (
   inphp_w3devil_com-3). So I’ve done some reading and I think this should work –
 * if ( function_exists(‘register_sidebar’) )
    { register_sidebar(array( ‘before_widget’
   => ”, ‘after_widget’ => $output = “”; if(name==’inphp_w3devil_com-3′) $output.
   = “</div></div>”; else $output .= “<div class=”more”>+ More</div></div>/div>”;‘
   before_title’ => ‘<h3>’, ‘after_title’ => ‘</h3>’, )); return $output;
 * }
 * But this gives me a TString error. Can anyone who’s more experienced with PHP
   lend a fresh pair of eyes to this? Please?

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

 *  Thread Starter [stereozeitgeist](https://wordpress.org/support/users/stereozeitgeist/)
 * (@stereozeitgeist)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/conditionally-display-after_widget-code/#post-1412534)
 * Yeah I’ve somehow bonked my functions file and going back to the original setting
   didn’t fix it either.
 * [http://pastebin.ca/1823383](http://pastebin.ca/1823383)
 * I’ve pastebinned it if anyone’s kind enough to take a look at it, my eyes hurt
   so I’m probably not thinking clearly.
 *  Thread Starter [stereozeitgeist](https://wordpress.org/support/users/stereozeitgeist/)
 * (@stereozeitgeist)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/conditionally-display-after_widget-code/#post-1412553)
 * All right, I’ve debonked my page, but I’m still stuck : trying to give unique
   after_widget attributes to individual widgets. I’ll keep looking…

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

The topic ‘conditionally display after_widget code?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [stereozeitgeist](https://wordpress.org/support/users/stereozeitgeist/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/conditionally-display-after_widget-code/#post-1412553)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
