Make WordPress Core

Opened 16 years ago

Last modified 4 years ago

#16443 new feature request

We need a way to programmatically tell if we are in a sidebar

Reported by: jorbin Owned by:
Priority: normal Milestone: Awaiting Review
Component: Widgets Version: 2.2
Severity: normal Keywords: needs-patch dev-feedback
Cc: Focuses:

Description

There is currently no way to tell if you are in_a_sidebar or doing a widget which makes me a sad stallman lookalike.

Attachments (1)

inside-widgets-sidebars.php​ (2.1 KB ) - added by filosofo 16 years ago.

Download all attachments as: .zip

Change History (11)

#1 @scribu
16 years ago

  • Keywords needs-patch added
  • Milestone Awaiting Review → Future Release

Sounds like a reasonable request.

#2 @mikeschinkel
16 years ago

  • Cc mikeschinkel@… added

#3 @filosofo
16 years ago

I'm not sure what you're trying to do, but you might be able to accomplish it by attaching a callback to the 'dynamic_sidebar' action hook.

#4 @markjaquith
16 years ago

That doesn't tell him that he's in a sidebar — just that one started. There is no hook that fires when the sidebar is done.

#5 @filosofo
16 years ago

I'm not saying we shouldn't add some more action hooks; inside-widgets-sidebars.php is just for fun to see if it could be done with the current code.

#6 @dreamwhisper
14 years ago

  • Cc dreamwhisper added

#7 @chriscct7
12 years ago

  • Type enhancement → feature request

Couldn't you do a did_action on dynamic_sidebar_before to check?

#8 @chriscct7
11 years ago

  • Keywords dev-feedback added

#9 @desrosj
4 years ago

  • Milestone → Awaiting Review

@jorbin is this still one you think would be beneficial?

#10 @jorbin
4 years ago

@desrosj yes, at least for classic themes.

Note: See TracTickets for help on using tickets.