How to setup sidebar modules to use jQuery Accordian

When you register your sidebar, you can change how it handles those things with the before_title, after_title, before_widget, and after_widget arguments. For example: register_sidebar(array( ‘before_widget’ => ”, ‘before_title’ => ‘<h3>’, ‘after_title’ => “</h3>\n<div>”, ‘after_widget’ => ‘</div>’ )); Would make all of the widgets in that sidebar have that structure. You could also add classes to … Read more

How to add testimonials with an image?

Make a new category called Testimonials then, in your theme folder add a new file called testimonials.php. Add this in the newly created file: <div id=”testimonials”> <?php $args = array(‘caller_get_posts’ => 1, ‘post_type’ => ‘testimonials’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 5); query_posts($args); if (have_posts()) : while (have_posts()) : the_post(); $image = get_post_meta($post->ID, ‘testimonial-image’, true); ?> … Read more

if (has_custom_menu())?

From looking at the Codex, you should be able to just pass the fallback_cb parameter as false to have wp_nav_menu return nothing. So something like: <?php wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’, ‘fallback_cb’ => FALSE ) ); ?>

How can I run code in functions.php when switch_theme() is called?

Well, instead of using a $_GET parameter you could store a initiate state in your options-table. E.g. $initialized = get_option(‘mytheme_initialized’); if ( (false === $initialized) && is_admin() && ($pagenow == ‘themes.php’) ) { //this code only runs when the theme is first activated update_option(‘mytheme_initialized’, true); } Unfortunately the “register_activation”-hook is only available for plugins -> … Read more

Hide/disable sidebar using shortcode?

Use this code to echo your div’s ID <?php $sidebar_layout = get_post_meta($post->ID, ‘sidebar-layout’, $single = true); ?> <div id=”<?php echo $sidebar_layout ?>”> <div class=”content”> … </div> <div class=”sidebar”> … </div> </div> If you want to apply styles according to the selection the user has made then change your style sheet as follows: #left .content{ … … Read more