What is the difference with get_sidebar and dynamic_sidebar?

What is the difference with get_sidebar() and dynamic_sidebar()? I was wondering which one I should use. Maybe one use widgets and the other one doesn’t? 1 Please refer to the get_sidebar() and dynamic_sidebar() Codex entries. The get_sidebar( $slug ) template tag includes the sidebar-$slug.php template-part file. The dynamic_sidebar( $slug ) template tag outputs the $slug … Read more

List all sidebar names?

I’m listing all sidebars like that: global $wp_registered_sidebars; echo ‘<pre>’; print_r($wp_registered_sidebars); echo ‘</pre>’ So I’m getting something like: Array ( [sidebar-1] => Array ( [name] => Sidebar #1 [id] => sidebar-1 List all sidebar names? => Sidebar number 1 [before_widget] => [after_widget] => [before_title] => [after_title] => ) (…) ) But I’d love to display … Read more

Loading scripts only if a particular shortcode or widget is present

I needed a way to filter a page/posts content before it was loaded so I could add scripts to the header if a specific shortcode was present. After much searching I came across this on http://wpengineer.com function has_my_shortcode($posts) { if ( empty($posts) ) return $posts; $found = false; foreach ($posts as $post) { if ( … Read more