Aller au contenu principal
MeteorGPLby WebbingApps
WL

Widget Logic

Extension
Suivre 0 Ajouter une étoile 0
Installer

Widget Logic lets you control on which pages widgets appear using WP's conditional tags.

  • 0 étoile
  • 0 personne le suit
  • 0 téléchargement
  • GPL-2.0-or-later

Versions 3

Les plus récentes d’abord · chaque version analysée avant publication
  1. 6.0.5 Dernière

    fixed Live Match widget block Notes de version

    28 fichiers 42,9 KB 11 modifiés +90 −34 Vérifié

  2. 6.0.4

    load of External Services only when Live Match widget used Notes de version

    26 fichiers 41,8 KB 15 modifiés +1 249 −483 Vérifié

  3. 5.10.4

    Security update. The export feature has been protected with nonce. Notes de version

    13 fichiers 28,9 KB Vérifié

Afficher 35 versions pas encore disponibles

Publications citées dans le journal des modifications de l’éditeur ou sur WordPress.org que le dépôt ne contient pas encore.

  1. 6.9 Pas encore disponible Date de publication non indiquée

    WordPress.org Plugins Team fixing versioning issue.

    Entrée du journal des modifications

  2. 6.0.8 Pas encore disponible Date de publication non indiquée

    Fixed minor bug with Live Match widget

    Entrée du journal des modifications

  3. 6.0.7 Pas encore disponible Date de publication non indiquée

    Enhanced Configuration section with detailed documentation for widgetlogicallowedfunctions filter

    Entrée du journal des modifications

  4. 6.0.6 Pas encore disponible Date de publication non indiquée

    reworked main logic function to avoid EVAL

    Entrée du journal des modifications

  5. 6.0.3 Pas encore disponible Date de publication non indiquée

    added settings option for enable new functionality

    Entrée du journal des modifications

  6. 6.0.2 Pas encore disponible Date de publication non indiquée

    fixed bug for php7.2

    Entrée du journal des modifications

  7. 6.0.1 Pas encore disponible Date de publication non indiquée

    Bug fixes

    Entrée du journal des modifications

  8. 6.0.0 Pas encore disponible Date de publication non indiquée

    Gutenberg widgets editor added

    Entrée du journal des modifications

  9. 5.10.3 Pas encore disponible Date de publication non indiquée

    Security update. Huge thanks to the Plugin Vulnerabilities Team!

    Entrée du journal des modifications

  10. 5.10.2 Pas encore disponible Date de publication non indiquée

    The plugin's security has been improved, big thanks to Paul Dannewitz for his excellent security audit!

    Entrée du journal des modifications

  11. 5.9.0 Pas encore disponible Date de publication non indiquée

    wpresetquery works better under certain conditions.

    Entrée du journal des modifications

  12. 5.8.2 Pas encore disponible Date de publication non indiquée

    The code has been adapted to work on the servers with restricted

    Entrée du journal des modifications

  13. 5.8.1 Pas encore disponible Date de publication non indiquée

    Fixed the issue of displaying errors under certain conditions.

    Entrée du journal des modifications

  14. 5.8.0 Pas encore disponible Date de publication non indiquée

    Added full support for WP customizer.

    Entrée du journal des modifications

  15. 5.7.4 Pas encore disponible Date de publication non indiquée

    Fixed the "Warning: Attempt to assign property of non-object" bug.

    Entrée du journal des modifications

  16. 5.7.3 Pas encore disponible Date de publication non indiquée

    Fixed the issue when in some cases the plugin displayed user logic errors in the Widgets section and this didn't allow to save the widgets.

    Entrée du journal des modifications

  17. 5.7.2 Pas encore disponible Date de publication non indiquée

    Removed conflicts with outdated WP versions.

    Entrée du journal des modifications

  18. 5.7.1 Pas encore disponible Date de publication non indiquée

    Fixed the settings form not being saved settings under some circumstances.

    Entrée du journal des modifications

  19. 5.7.0 Pas encore disponible Date de publication non indiquée

    Fixed PHP 7 compatibility issue.

    Entrée du journal des modifications

  20. 0.57 Pas encore disponible Date de publication non indiquée

    Small fixes to satisfy some define('WPDEBUG', true) errors

    Entrée du journal des modifications

  21. 0.56 Pas encore disponible Date de publication non indiquée

    Small fix to the original WP3.5 fix in 0.54 that had the side effect of failing to save logic text on newly added widgets.

    Entrée du journal des modifications

  22. 0.55 Pas encore disponible Date de publication non indiquée

    Restored a striplashes that vanished in 0.54 causing much grief.

    Entrée du journal des modifications

  23. 0.54 Pas encore disponible Date de publication non indiquée

    Removed a WP 3.1+ function call, hopefully making it 2.8 compatible again.

    Entrée du journal des modifications

  24. 0.53 Pas encore disponible Date de publication non indiquée

    Accidentally released code with a terrible bug in it :-(

    Entrée du journal des modifications

  25. 0.52 Pas encore disponible Date de publication non indiquée

    Two new features: optional delayed loading of logic (see Configuration under Installation), and the ability to save out and reload all your...

    Entrée du journal des modifications

  26. 0.51 Pas encore disponible Date de publication non indiquée

    One important bug fix (fairly major and fairly stupid of me too)

    Entrée du journal des modifications

  27. 0.50 Pas encore disponible Date de publication non indiquée

    For the first time since this started on WP 2.3, I've rewritten how the core widget logic function works, so there may be 'bumps ahead'.

    Entrée du journal des modifications

  28. 0.48 Pas encore disponible Date de publication non indiquée

    Kill some poor coding practices that throws debug notices - thanks to John James Jacoby.

    Entrée du journal des modifications

  29. 0.47 Pas encore disponible Date de publication non indiquée

    FINALLY tracked down the elusive 'wpresetquery' option resetting bug.

    Entrée du journal des modifications

  30. 0.46 Pas encore disponible Date de publication non indiquée

    Fix to work with new WP2.8 admin ajax. With bonus fixes.

    Entrée du journal des modifications

  31. 0.44 Pas encore disponible Date de publication non indiquée

    Officially works with 2.7 now. Documentation changes and minor bug fixes.

    Entrée du journal des modifications

  32. 0.43 Pas encore disponible Date de publication non indiquée

    simple bug fix (form data was being lost when 'Cancel'ing widgets)

    Entrée du journal des modifications

  33. 0.42 Pas encore disponible Date de publication non indiquée

    WP 2.5+ only now. WP's widget admin has changed so much and I was getting tied up in knots trying to make it work with them both.

    Entrée du journal des modifications

  34. 0.31 Pas encore disponible Date de publication non indiquée

    Last WP 2.3 only version

    Entrée du journal des modifications

  35. 0.4 Pas encore disponible Date de publication non indiquée

    Brings WP 2.5 compatibility. I am trying to make it back compatible. If you have trouble using WL with WP 2.1--2.3 let me know the issue. Th...

    Entrée du journal des modifications

Widget Logic

Widget Logic lets you control on which pages widgets appear using WP's conditional tags.

This plugin gives every widget an extra control field called "Widget logic" that lets you control the pages that the widget will appear on. The text field lets you use WP's Conditional Tags, or any general PHP code.

PLEASE NOTE The widget logic you introduce is EVAL'd directly. Anyone who has access to edit widget appearance will have the right to add any code, including malicious and possibly destructive functions. There is an optional filter 'widget_logic_eval_override' which you can use to bypass the EVAL with your own code if needed. (See Other Notes).

The configuring and options are in the usual widget admin interface.

BIG UPDATE:

  • Now you can control widget in Gutenberg Widgets editor as well as in Classic Editor. It is just as easy as before but also in gutenberg view.

  • Pre-installed widgets let you add special widget with one click of the mouse. First pre-installed widget is Live Match that let you add widget of one random live football game with real time score updates (teams logos, livescore, minute of the match, tournament name). And more interesting widgets to come!

Configuration

Aside from logic against your widgets, there are three options added to the foot of the widget admin page (see screenshots).

  • Use 'wp_reset_query' fix -- Many features of WP, as well as the many themes and plugins out there, can mess with the conditional tags, such that is_home is NOT true on the home page. This can often be fixed with a quick wp_reset_query() statement just before the widgets are called, and this option puts that in for you rather than having to resort to code editing

  • Load logic -- This option allows you to set the point in the page load at which your widget logic if first checked. Pre v.50 it was when the 'wp_head' trigger happened, ie during the creation of the HTML's HEAD block. Many themes didn't call wp_head, which was a problem. From v.50 it happens, by default, as early as possible, which is as soon as the plugin loads. You can now specify these 'late load' points (in chronological order):

    • after the theme loads (after_setup_theme trigger)
    • when all PHP loaded (wp_loaded trigger)
    • after query variables set (parse_query) – this is the default
    • during page header (wp_head trigger)

    You may need to delay the load if your logic depends on functions defined, eg in the theme functions.php file. Conversely you may want the load early so that the widget count is calculated correctly, eg to show an alternative layour or content when a sidebar has no widgets.

  • Don't cache widget logic results -- From v .58 the widget logic code should only execute once, but that might cause unexpected results with some themes, so this option is here to turn that behaviour off. (The truth/false of the code will be evaluated every time the sidebars_widgets filter is called.

Interaction with External Services

Widget Logic uses the external service to obtain up-to-date information about the results of football matches. widgetlogic.org is a source of sports information, that provides a wide range of information about football, including various leagues, tournaments, and championships from around the world.

The functioning of the widgetlogic.org service is based on delivering real-time data about selected matches without the need to refresh the page. This means that data is automatically updated without requiring page reload. This approach ensures users quick and uninterrupted access to the latest sports data without the effort of manually updating information, allowing them to stay informed about ongoing events in real-time.

Ce qu’il apporte

  • 1 bloc(s) : Live Match

Faq

Can I use Widget Logic in Gutenberg widgets view?

Yes, you can! Starting from 6.0.0 you can use Widget Logic in Gutenberg widgets and in Classic Widgets. So if you have earlier version, please update plugin.

What can I try if it's not working?

  • Switch to the default theme. If the problem goes away, your theme may be interfering with the WP conditional tags or how widgets work
  • Try the wp_reset_query option. If your theme performs custom queries before calling the dynamic sidebar this might help.
  • Try a different 'Load logic' point. Most wordpress conditional tags only work 'after query variables set', but some plugins may require evaluation earlier or later.
  • The 'Evaluate widget logic more than once' option may be needed if you have to use an early 'Load logic' point.

I'm getting errors that read like "PHP Parse error… … eval()'d code on line 1"

You have a PHP syntax error in one of your widget's Widget Logic fields. Review them for errors. You might find it easiest to check by using 'Export options' and reading the code there (Though be aware that single and double quotes are escaped with multiple backslash characters.)

If you are having trouble finding the syntax error, a simple troubleshooting method is to use 'Export options' to keep a copy and then blank each Widget Logic field in turn until the problem goes. Once you've identified the problematic code, you can restore the rest with 'Import options'.

It's causing problems with Woo Commerce / other popular plugin

This is often, not always, fixed by trying the different 'Load Logic' options. The 'after query variables set' option looks like it might be a better default, try it.

What's this stuff in my sidebar when there are no widgets?

Since v .50 the widget logic code runs such that when dynamic_sidebar is called in a theme's code it will 'return false' if no widgets are present. In such cases many themes are coded to put in some default sidebar text in place of widgets, which is what you are seeing.

Your options, if you want this default sidebar content gone, are to either edit the theme, or as a work around, add an empty text widget (no title, no content) to the end of the sidebar's widget list.

How do I get widget X on just my 'home' page? (Or on every page except that.)

There is some confusion between the Main Page and the front page. If you want a widget on your 'front page' whether that is a static page or a set of posts, use is_front_page(). If it is a page using is_page(x) does not work. If your 'front page' is a page and not a series of posts, you can still use is_home() to get widgets on that main posts page (as defined in Admin > Settings > Reading).

Logic using is_page() doesn't work

I believe this is fixed in 5.7.0. Let me know if that is not the case.

If your theme calls the sidebar after the loop you should find that the wp_reset_query option fixes things. This problem is explained on the is_page codex page.

How do I get a widget to appear both on a category page and on single posts within that category?

Take care with your conditional tags. There is both an in_category and is_category tag. One is used to tell if the 'current' post is IN a category, and the other is used to tell if the page showing IS for that category (same goes for tags etc). What you want is the case when:

(this page IS category X) OR (this is a single post AND this post is IN category X) which in proper PHP is:

is_category(X) || (is_single() && in_category(X))

How do I get a widget to appear when X, Y and Z?

Have a go at it yourself first. Check out the 'Writing Logic Code' section under Other Notes.

Why is Widget Logic so unfriendly, you have to be a code demon to use it?

This is sort of deliberate. I originally wrote it to be as flexible as possible with the thought of writing a drag'n'drop UI at some point. I never got round to it, because (I'm lazy and) I couldn't make it both look nice and let you fall back to 'pure code' (for the possibilities harder to cater for in a UI).

The plugin Widget Context presents a nice UI and has a neat 'URL matching' function too.

Widgets appear when they shouldn't

It might be that your theme performs custom queries before calling the sidebar. Try the wp_reset_query option.

Alternatively you may have not defined your logic tightly enough. For example when the sidebar is being processed, in_category('cheese') will be true if the last post on an archive page is in the 'cheese' category.

Tighten up your definitions with PHPs 'logical AND' &&, for example:

is_single() && in_category('cheese')

Screenshots

  1. The 'Widget logic' field at work in Gutenberg widgets.
  2. The 'Widget logic' field at work in Classic widgets.
  3. The plugin options are at the foot of the usual widget admin page… wp_reset_query option, 'load logic point' and 'evaluate more than once'. You can also export and import your site's WL options as a plain text file for a quick backup/restore and to help troubleshoot issues.
  4. Pre-installed 'Live Match' widget in widgets section
  5. Pre-installed 'Live Match' widget on website

Upgrade Notice

0.58

Important change to the default of when your Widget Logic is evaluated. It is now on the "parse_query" action, and just once. Those defaults can be overridden.

0.46

Required with WP2.8 cos of changes in Widget admin AJAX

0.44

Updated for WP2.7 with extra bug fixes

Installer

composer require meteorgpl-plugin/widget-logic

Les vérifications de licence de l’éditeur sont intactes : activez l’extension dans WordPress avec une clé de licence achetée auprès de l’éditeur.

Licence

Licence déclarée : GPL-2.0-or-later. Le code est redistribué sous la licence que l’éditeur a déclarée dans les en-têtes de l’extension. Profil de licence : gpl-full.

Les illustrations, polices, médias et documents susceptibles d’être soumis à une licence distincte ne sont pas redistribués ; la page sur les licences explique ce qui est remplacé ou supprimé, et l’onglet Sécurité le détaille par version. Le droit au support et aux mises à jour vient avec la licence que vous achetez auprès de l’éditeur.

Envoyer votre avis

Ce qui fonctionne, ce qui ne fonctionne pas, ce qui manque : quelques mots suffisent.

Seulement si vous souhaitez une réponse.

Prise dans votre navigateur, sans cette fenêtre. Les mots de passe, ce que vous avez saisi dans les formulaires, les clés et les jetons sont exclus et remplacés par des blocs gris ; vous pouvez masquer d’autres zones avant l’envoi. Nous conservons les captures 90 jours.

Nous l’enregistrons avec l’adresse de la page, votre langue, la taille de la fenêtre, le navigateur et l’adresse IP, ainsi que votre adresse e-mail si vous en indiquez une. L’adresse IP et le navigateur sont supprimés après 90 jours. Politique de confidentialité.

Toutes les langues