alanft
Forum Replies Created
-
Forum: Plugins
In reply to: [Widget Logic] Widget Logic being called over and over(In case you look back in)
BTW, I have been looking into this! You’ve set me wondering if executing just once might fix a lot of the quirks people see in widget logic. And it occurred to me that of course though I can’t stop the filter being called multiple times that it could cache the results the first time.
Might toy with a ‘Don’t cache the logic’ option in case that breaks some people’s sites
So, thanks for making me think!
Forum: Plugins
In reply to: [Widget Logic] Widget Logic Clearly Not Working For MeThere is a FAQ about a common problem using is_page that may apply
Forum: Plugins
In reply to: [Widget Logic] Widget Logic being called over and overI’m open to suggestions to improve things! I try to keep WL to a minimal “profile” in code of course.
But eg if you have 15 widgets on a page, it’s not all of widget logic’s plugin code runs 15 times, and if you only have code in one widget, then that code will run once if your site just calls dynamic_sidebar() once.
Some sites do more, having multiple sidebars or calling is_active_sidebar() which needs to enumerate the widgets (which in turn needs to filter out inactive widgets).
In the case of multiple sidebars it’s not immediately obvious how to minimise the repeat calls – the dynamic_sidebar routine calls wp_get_sidebars_widgets() with no parameters and that just calls the filter to act on all widgets on all sidebars.
In the worst case where WL plugin is active and all widgets have no actual WL code in them, the actual executing code in the plugin is very minimal
Forum: Plugins
In reply to: [Widget Logic] Widget Logic being called over and overThe main hook is the filter ‘sidebars_widgets’ which is mainly called in the ‘wp_get_sidebars_widgets’ function, and that is called in a number of other functions, eg is_active_sidebar(), dynamic_sidebar() and so on.
Forum: Plugins
In reply to: [Widget Logic] Error: widget_logic.php(286) : eval()'d code on line 1the error is caused by the execution of the WL code you’ve put in against one of your widgets. one method of troubleshooting is to save out the WL config and then check each widget in turn, clear the text out of each one and save until the error goes.
Forum: Plugins
In reply to: [Widget Logic] php code for template to limit certain pagesI’m not quite sure what you have in mind, but you could circumvent the need for WL entirely, but use the same technique it employs. Basically you can filter widgets with
add_filter( ‘sidebars_widgets’, my_own_filter_sidebars_widgets’, 10);
and then your function can loop through the sidebars, and each widget in them, unsetting any widget you like and then passing back the result
function my_own_filter_sidebars_widgets($sidebars_widgets) { foreach($sidebars_widgets as $widget_area => $widget_list) { foreach($widget_list as $pos => $widget_id) { … … if (some condition perhaps based on $widget_id) unset($sidebars_widgets[$widget_area][$pos]); … … } } return $sidebars_widgets; }Forum: Plugins
In reply to: [Search Regex] Bug on LIMIT queriesJust hit this on post_meta searches. Plus for some reason if i use “no limit” I get nothing back but if I hack in a $limit=100000 I get back the 46k results (I have a lot of post_meta!) I was after checking through
Forum: Plugins
In reply to: [Widget Logic] Using plugin to change title to imageYou need to tick the widget_content filter option, then the hard bit is writing a filter. There’s some basic guidance here…
http://wordpress.org/plugins/widget-logic/other_notes/
The ‘ttftitles’ example code may be a good model to try out.
Forum: Plugins
In reply to: [Widget Logic] Debug Error@myelomauk – that’s down to something in the logic code you have set in one your widgets.
I’ll track down the problem in the original post, which is a similar problem in the widget logic plugin code.
Forum: Plugins
In reply to: [Widget Logic] PHP Parse Error Line 286@ andrewdaugdaug
anything starting “Parse error” ending “eval()’d code on line X” is a problem with the syntax of the logic in one of your widgets@bigshow/@ahmalh111
I’m not seeing this problem in general, so not sure it is caused by WL. You can “enable accessibility mode” (under screen options) if there’s a javascript issue preventing you accessing widget controls “dynamically”. That should help.Forum: Plugins
In reply to: [Widget Logic] Ukrainian translationdeal!
I see the widget on all the pages, though the content is different on the /product-category/bras/ page. widget logic only determines if the widget appears or not, and if the code is
ICL_LANGUAGE_CODE == 'en'then that’s always going to be true or false depending on how the user has set WPML to displayForum: Plugins
In reply to: [Widget Logic] Will you be updating to be compatible with WP 3.9 soon?yes – I have tried it and it’s OK, so will update compatibiity tag soon
Forum: Plugins
In reply to: [Widget Logic] widget disappears(and there shouldn’t be a space between $ and _SESSION)
Forum: Plugins
In reply to: [Widget Logic] widget disappearsthat’s not a complete statement that returns true or false, and is probably causing a PHP error failing entirely.
what you are after is
return ($ _SESSION ['post_city_id'] == 'xx');and you can go even simpler than that as if you don’t include a return statement in your code, WL puts one in for you (and the brackets and the semicolon). So you can just use
$ _SESSION ['post_city_id'] == 'xx'