alanft
Forum Replies Created
-
Forum: Plugins
In reply to: [Widget Logic] Dont understand instructions for widget loicwhat determines which version of a widget a site visitor should see?
Forum: Plugins
In reply to: [Widget Logic] [Plugin: Widget Logic] Only for parent and child pages?great, glad you’re sorted.
that’s the solution for a specific page or the children of a specific page.
is 77 the ID of the supplies page?
Forum: Plugins
In reply to: [Widget Logic] Combining conditionssorry – I missed it was your main blog page. the is_page(‘blog’) probably wouldn’t work then. You’ll likely need is_home() or is_front_page() depending on how you’ve got your site setup. See…
Forum: Plugins
In reply to: [Widget Logic] [Plugin: Widget Logic] Only for parent and child pages?i googled this
http://www.wpgeek.com/tutorials/how-to-check-if-wordpress-page-have-subpages-or-childrens/
which suggests you could do this for when a page has children
global $post; return (count(get_pages('child_of='.$post->id))>0);this for checking the page has a parent
global $post; return($post->post_parent != 0);and then combine when either is true with
global $post; return (count(get_pages('child_of='.$post->id))>0) || ($post->post_parent != 0);i’d be interested to know if that works
return is_page('supplies') || (in_array(77,get_post_ancestors($post)));should do it
Forum: Plugins
In reply to: [Widget Logic] Combining conditionsyou need to use && AND instead of || OR, because what you want to say is
“show the widget (when it’s NOT single) AND (when it’s NOT page X)”
if you put OR in there you’ll always get the widget except when it’s single and page X
Forum: Plugins
In reply to: [Widget Logic] is_search(), is_single( '213' ) NOT WorkingUse || instead of ,
‘is_search() || is_single( ‘213’ )`
which comes back TRUE when either is_search() is TRUE or is_single(…) is TRUE (or both!)
http://wordpress.org/extend/plugins/widget-logic/other_notes/
Forum: Plugins
In reply to: [Widget Logic] Child pages using page name not page IDyou could put it in the WL code if you liked…
global $post; $page = get_page_by_title( 'Sample Page' ); $ID=$page->ID; $ancestors = get_post_ancestors($post); return in_array($ID,$ancestors));But it would be inefficient calculating the ID of a page every time a page is requested, as the ID will not change. So just get the ID of the page from the admin page instead.
Forum: Plugins
In reply to: [Widget Logic] Parse error when widget logic activatedyou have some rogue widget logic code in one of your widgets. go through each widget, check the code each time.
it should be possible to save out your WL settings, and then blank each one until the error goes, then you can restore from the saved saved settings file and blank just the one that fixed it.
Forum: Plugins
In reply to: [Widget Logic] Child pages using page name not page IDhttp://codex.wordpress.org/Function_Reference/get_post_ancestors says that it returns an “Array of IDs” so no, you can’t use page names directly.
But, http://codex.wordpress.org/Function_Reference/get_page_by_title has code to get the ID from the page title…
$page = get_page_by_title( 'Sample Page' ); $ID=$page->ID;Hope that helps!
(Note that the get_post_ancestors example is in the WL ‘other notes’ section already! http://wordpress.org/extend/plugins/widget-logic/other_notes/ )
Forum: Plugins
In reply to: [Widget Logic] Weather widget and Widget Logicto be honest I couldn’t follow your description, couldn’t see the widget on other pages, and can’t get the plugin to work at all on my site with NO widget logic.
try some basic troubleshooting like this. setup 3 widgets, deactivate widget logic. do they all work as expected.
turn on widget logic and clear out any logic. still showing?
put in widget logic of one as ‘true’, one as ‘false’ and the third one your is_page logic from before. how’s that look?
Forum: Plugins
In reply to: [Widget Logic] Use custom field data with widget logic?I don’t do paid support, sorry
my advice is to use a PHP widget that allows you to look at the output value of various functions so you can work your way to the root of the problem. set a PHP widget up and do something like
global $post; print_r( get_post_meta($post->ID, 'featured-ads', true))to see what you’re getting in response
Forum: Plugins
In reply to: [Widget Logic] Use custom field data with widget logic?according to the function reference page here
http://codex.wordpress.org/Function_Reference/get_post_metayour call get_post_meta($post->ID, ‘featured-ads’, false) will return an array not a string, so try that third parameter as true instead
Forum: Plugins
In reply to: [Widget Logic] Could you help hiding widget to a specific user group please ?There’s a link on this codex page about current_user_can()
http://codex.wordpress.org/Function_Reference/current_user_canto a function someone’s written called appthemes_check_user_role
that might do the trick, or you might just find that current_user_can (which keys against capabilities rather than roles) will do you just as well.