Do not display when a conditional is selected

#1
Hi,

I love the GP Extender. Makes life a lot easier.

I use the Labels, Conditionals and Hook Boxes to show a box at the top of all pages on a website.

However, I'd like to add a Label to all pages which, if checked on a specific page, it causes the box to not display on that page. It's almost like a reverse conditional.

Is that possible?
 
#3
Here's the solution...

Go to GP Extender > Extender Custom

Click on the Labels tab

In the Name field for a label, add your name. I used "No top box"

Check the box that reads, "Automatically create a Custom Conditional for this Label"

Click the Save changes button

Click on the Conditionals tab

You'll notice that GP Extender has created a Conditional from the label (with the name, has_label_no_top_box)

In my case, the Tag for the conditional is gp_extender_has_label('no-top-box')

Now add an exclamation mark in front of that tag, so it looks like this: !gp_extender_has_label('no-top-box')

Click on the Hook Boxes tab (I've created a hook box and added a sliver of shortcode to display something in a specific location)

Click on the Select Conditionals dropdown

Check has_label_no_top_box

Click Save Changes

Nagivate to a page (or post) where you don't want the box to display.

Down the page somewhere you'll find a box with the heading GP Extender Labels

Check the No top box label and Update the page.

The box should now be gone only on that page.
 

siga

Moderator
#4
That was me and I deleted the comment as soon as I realized that I misread something in your original description and posted code for Dynamik labels...
I´m glad to hear you were still able to edit in a way that was useful for what you needed. Thanks for taking the time to post the solution! :)