Suggestion: Show widget only when subpages exist
-
When adding [subpages] as a widget, I have to use Widget Logic to determine whether or not subpages exists. Otherwise, the widget title appears without a corresponding list of subpages.
Would be useful to integrate the following function into Page-list plugin:
function pagelist_has_subpages() { global $post; $children = get_pages('child_of='.$post->ID); if( count( $children ) > 0 ) { $parent = true; } return $parent; }
Users could then add the following conditional logic via Widget Logic:
is_page() && pagelist_has_subpages()
- The topic ‘Suggestion: Show widget only when subpages exist’ is closed to new replies.