alanft
Forum Replies Created
-
Forum: Plugins
In reply to: [Widget Logic] Conditional Tag based on Search ResultsYou could use a test on the values in $_GET http://php.net/manual/en/reserved.variables.get.php
The $_GET array is filled with the URL parameters after the question mark. So e.g. in the above
$_GET[“search-class”]=”DB_CustomSearch_Widget-db_customsearch_widget”
$_GET[“widget_number”]=”preset-1″
$_GET[“cs-zip-0″]=”76109”
$_GET[“search”]=”Search”Forum: Plugins
In reply to: [Widget Logic] Limit to 1 widgethmm. perhaps not, sorry.
i’d be interested to know if it made a difference changing the ‘load logic’ point while using that style code. And ultimately if the ‘developer’ version worked with code like this too.
(I made some big changes in the dev version but I’m finding it hard to commit to the changes because it’s hard to get anyone to beta test)
Forum: Plugins
In reply to: [Widget Logic] Limit to 1 widgetyou can use statements that are full PHP code blocks with an explicit ‘return’. So you should be able to try things like this…
global $MY_ADS; $MY_ADS++; return (is_single() && in_category('Topic-A'));(note the final semi-colon), and
global $MY_ADS; $MY_ADS++; return (is_single() && in_category('Topic-B') && ($MY_ADS<2));have a go
Forum: Plugins
In reply to: [Widget Logic] Use of undefined constant is_user_logged_inis_user_logged_in is not a useful constant, you’re after the function
is_user_logged_in()see here…
http://codex.wordpress.org/Function_Reference/is_user_logged_in
all the best
Forum: Plugins
In reply to: [Widget Logic] Bug, issue with names that have dashesare you sure that’s not just cos you’re not putting quotes around those strings?
If so will investigate to see if dashes are being escaped oddly
Forum: Plugins
In reply to: [Widget Logic] Use on Woocommerce product categoryDoes this page help…
Forum: Plugins
In reply to: [Widget Logic] combine 2 statementsI don’t use WPML, but it looks like you are on the right track.
certainly try the parts separately
ICL_LANGUAGE_CODE == ‘nl’in one widget for instance.in_category() will work on individual posts in a specified category , so if that’s what the URL means yes that should work too, and combining them with && will show them when both statements are true
Forum: Plugins
In reply to: [Widget Logic] is_author() for the postis_author “checks if an Author archive page is being displayed”
http://codex.wordpress.org/Function_Reference/is_author
Do you want to show a widget to a logged in user who is the author of the displayed post?
There is a global $userdata, and $userdata->ID is the ID of any logged in user.
I don’t know what the simplest way of getting the post author ID is, but a long way round is to use the global $wp_query, something like…
$author_obj=get_userdata(($wp_query->post)->post_author);
not sure if you can do it as concisely as that you may, you may have to break that down into evaluate each -> first. Then when you have $author_obj and $userdata, you can use
return ($author_obj->ID)==($userdata->ID);Forum: Plugins
In reply to: [Widget Logic] Not compatible with php 5.5You have problems in text-10 and text-11, both have the parameter missing a quote
is_category( '5 )is causing
Parse error: syntax error, unexpected ''5 ));' (T_ENCAPSED_AND_WHITESPACE)and ditto for the next one.
easy. the mystery is how updating PHP alone could have removed the quotes from the middle of those two bits of text
Forum: Plugins
In reply to: [Widget Logic] Not compatible with php 5.5the error
Parse error: syntax error, unexpected ''46 ));' (T_ENCAPSED_AND_WHITESPACEand its like are typical of syntax mistakes in widget logic entered into a widget logic field. I’ve installed a MAMP with PHP5.5 and done a few trivial tests, but not found any generic problem yet. It could be the installation has in some way corrupted the widget logic to make that happen, but it doesn’t look like it’s down to either PHP5.5 or the widget logic plugin itself.
In the admin backend you should be able to clear out all the widget logic and start again. Save out your config first with the “Widget Logic options” export button if you like. In fact if you post that I might be able to spot the widget logic that’s giving you trouble.
Here’s a simple test site exported config as an example
[START=WIDGET LOGIC OPTIONS] search-2 "is_home()" recent-posts-2 "false" [STOP=WIDGET LOGIC OPTIONS]Forum: Plugins
In reply to: Mediaelement hooks? (eg to fire Google Analytic _trackEvent)there appears to be some way of doing it with a global var of _wpmejsSettings. I’m working towards using that nicely, but for now and for the record I’ve managed to get plays registered as GA events by hacking the wordpress/wp-includes/js/mediaelement/wp-mediaelement.js file. You can add some lines to the ‘finished setting up media’ callback function setting.success like this…
settings.success = function (mejs) {
…
mejs.addEventListener( ‘play’, function () {
_gaq.push([‘_trackEvent’,’MediaElement’,’Play’,this.src]);
}, false );
}Forum: Plugins
In reply to: [Widget Logic] Language does not workDo your english versions of those 2 pages have ?lang=en in the URL (or ?…&lang=en…)
try changing the “Load logic” value in the Widget Logic options – it could be that the buddypress conditionals only work ‘late on’, so try “when all PHP loaded” and see if that helps
Forum: Plugins
In reply to: [Widget Logic] widget logic to one page and all of the subpagesI think instead of is_tree function you could use the http://codex.wordpress.org/Function_Reference/get_post_ancestors function in WP core. There’s an example in the “Other notes’ here https://wordpress.org/plugins/widget-logic/other_notes/
global $post; return (in_array(77,get_post_ancestors($post)));will return true for any child or grand-child etc, of post/page ID 77
Hope that helps
I’ve never used buddypress myself. a quick search for the word ‘profile’ on that page leads me to this that looks promising
bp_is_user_profile() Used to determine if the current page is a profile screen.
Returns:
TRUE if current page is a profile page
FALSE otherwise