Changeset 955604
- Timestamp:
- 07/27/2014 04:37:31 PM (12 years ago)
- Location:
- widget-logic/trunk
- Files:
-
- 4 edited
-
readme.txt (modified) (5 diffs)
-
screenshot-1.png (modified) (previous)
-
screenshot-2.png (modified) (previous)
-
widget_logic.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
widget-logic/trunk/readme.txt
r955420 r955604 41 41 * 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 42 42 43 * 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. 44 43 45 * Load logic -- This option allows you to set the point in the page load at which your widget logic starts to be 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): 44 46 * after the theme loads (after_setup_theme trigger) 45 47 * when all PHP loaded (wp_loaded trigger) 48 * after query variables set (parse_query) 46 49 * during page header (wp_head trigger) 47 50 … … 50 53 == Frequently Asked Questions == 51 54 52 = Why isn't it working? = 53 54 Try switching to the WP default theme - if the problem goes away, there is something specific to your theme that may be interfering with the WP conditional tags. 55 56 The most common sources of problems are: 57 58 * The logic text on one of your widgets is invalid PHP 59 * Your theme performs custom queries before calling the dynamic sidebar -- if so, try ticking the `wp_reset_query` option. 60 61 = Use 'wp_reset_query' fix option isn't working properly any more = 62 63 In version 0.50 I made some fundamental changes to how Widget Logic works. The result was that the wp_reset_query was less targeted in the code. If lots of people find this problematic I will look at a general solution, but the main workround is to put wp_reset_query() into your code just before calling a dynamic sidebar. 55 = I upgraded to Version .58 and my site's widgets now behave differently = 56 57 There were TWO important changes to how your Widget Logic code is evaluated. There is a new default 'Load logic' point of 'after query variables set'. For most people this should be better, but you could try reverting to the old default 'when plugin starts'. 58 59 Also by default your widget logic now only executes once (at the 'Load logic' point, see above). Again, I expect this will suit most of the people most of the time, but maybe your site works better the old way. Tick the new 'Evaluate widget logic more than once' option. 60 61 = What can I try if it's not working? = 62 63 * Switch to the default theme. If the problem goes away, your theme may be interfering with the WP conditional tags or how widgets work 64 * Try the `wp_reset_query` option. If your theme performs custom queries before calling the dynamic sidebar this might help. 65 * Try a different 'Load logic' point. Most wordpress conditional tags only work 'when query variables set', but some plugins may require evaluation earlier or later. 66 * The 'Evaluate widget logic more than once' option may be needed if you have to use an early 'Load logic' point. 67 68 69 = I'm getting errors that read like "PHP Parse error… … eval()'d code on line 1" = 70 71 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.) 72 73 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'. 74 75 = It's causing problems with Woo Commerce / other popular plugin = 76 77 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. 64 78 65 79 = What's this stuff in my sidebar when there are no widgets? = … … 74 88 75 89 = Logic using is_page() doesn't work = 90 91 I believe this is fixed in 0.58. Let me know if that is not the case. 76 92 77 93 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](http://codex.wordpress.org/Function_Reference/is_page#Cannot_Be_Used_Inside_The_Loop). … … 108 124 109 125 1. The 'Widget logic' field at work in standard widgets. 110 2. The `widget_content` filter, `wp_reset_query` option and 'load logic point' options are at the foot of the widget admin page. You can also export and import your site's WL options for safe-keeping.126 2. The `widget_content` filter, `wp_reset_query` option, 'don't cache results' option and 'load logic point' options are at the foot of the widget admin page. You can also export and import your site's WL options for safe-keeping. 111 127 112 128 == Writing Logic Code == … … 185 201 == Changelog == 186 202 203 = 0.58 = 204 A new default load logic point attached to the action 'parse_query'. By default the widget logic is only evaluated once. 205 187 206 Translation: Ukrainian by Roman Sulym 188 207 -
widget-logic/trunk/widget_logic.php
r955427 r955604 16 16 17 17 global $wl_options; 18 $wl_load_points=array( 'plugins_loaded' => __( 'when plugin starts (default)', 'widget-logic' ),18 $wl_load_points=array( 'plugins_loaded' => __( 'when plugin starts', 'widget-logic' ), 19 19 'after_setup_theme' => __( 'after theme loads', 'widget-logic' ), 20 20 'wp_loaded' => __( 'when all PHP loaded', 'widget-logic' ), 21 'parse_query' => __( ' after query variables set', 'widget-logic'),21 'parse_query' => __( 'when query variables set (default)', 'widget-logic'), 22 22 'wp_head' => __( 'during page header', 'widget-logic' ) 23 23 );
Note: See TracChangeset
for help on using the changeset viewer.