Home Forums WPStudio Plugins Introducing "GutenLogic"

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #17017
    Benjamin
    Keymaster

    Or maybe another name... but right now it's called "GutenLogic" for lack of a better name.

    GutenLogic

    So the genesis of this little plugin came about because of my love of the Widget Logic plugin that has been on most of my WordPress sites for the past 15 years. The ability to use WordPress Conditional Tags is incredibly powerful. BUT... with the release of WordPress 5.8 and the new Widget screen, life changed if you relied on Widget Logic and weren't going to use a plugin like "Classic Widgets" or "Disable Gutenberg" to maintain the old Classic Editor or the traditional widget screen (and even the widget control in the Customizer).

    So, I went looking at most of the "Display Control" plugins that would offer any type of conditional logic. Most of them are bloated cows that try and throw the kitchen sink at a problem and are filled with "features" that have nothing to do with "conditional logic". Plus, my need set was fairly narrow in scope because I could already control WordPress blocks using the forked Members plugin that sets permissions on which type of user is able to see or not see a block. Because this functionality already existed in that plugin I didn't need to duplicate the functionality.

    I did come across an outdated plugin that was completely broken with the current version of WordPress and the latest changes to Gutenberg/Block Editor. So, I cleaned it up. Fixed the implementation with the new Widget area. Got rid of a number of error messages that popped up from the code. And also added the conditional functionality to the Customizer control of Widgets. So what do we have... We have "GutenLogic". The "Widget Logic" solution for Gutenberg (plus it does even more than Widget Logic).

    In the new WordPress 5.8 Widget controls...

    Now each block you place in a sidebar/widget area has a new field added to the "Advanced" section that allows for Conditional Logic (and more).
    GutenLogic

    Even in the Customizer's control of the widgets...

    On each block placed in a "sidebar/widget" area you can click the "Show More Settings"...
    Gutenlogic
    And you'll be presented with another "Advanced" section with the GutenLogic field for your conditional tags.
    GutenLogic

    Plus, GutenLogic works in the regular Block Editor to grant you full control

    GutenLogic

    I will try and get everyone a copy of this plugin sometime tomorrow. I just need to wrap it up and push it out the door.

    #17018
    Benjamin
    Keymaster

    Who is this plugin for?

    If you rely on straight WordPress Conditional Tags (Conditional Tags Codex) and were missing the option of using this method of "control" in the Gutenberg/Block Editor.

    #17019
    Benjamin
    Keymaster

    You can use the following types of PHP instructions in GutenLogic:

    • Use regular WordPress Conditional Tags
      • You can use the ! exclamation point to "reverse" the logic statement. !is_front_page() returns true when the visitor is NOT on the frontpage.
      • You can combine conditions using the || (pipes) for an OR statement that returns true if EITHER statement #1 or Statement #2 is true.
      • You can combine with more specific condition using the && (double ampersand) to return true if BOTH statement #1 and statement #2 are true.
      • And all the traditional WordPress conditional tags work like is_home(), is_page(array(3,6,7)), is_user_logged_in()
    • You can also evaluate a statement to check a server-level condition like checking to see if a visitor is coming from duckduckgo.com using the code strpos($_SERVER['HTTP_REFERER'], "duckduckgo.com")!=false
    • You could even go as far as returning true if a page is a "child" of a certain post ID using code global $post; return (in_array(234,get_post_ancestors($post)));

    So, as you can see, the capabilities of the GutenLogic is extensive if you are willing to think through the power it opens.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.