Display a different theme for not logged-in users

Try hooking on all these: (But I guess you’d have to do it from a plugin, since doing it from theme functions.php might be too late). E.g.: /* Plugin Name: test Description: switchtest Version: 0.1.0 */ add_filter( ‘template’, ‘yourthing_switch_theme’ ); add_filter( ‘option_template’, ‘yourthing_switch_theme’ ); add_filter( ‘option_stylesheet’, ‘yourthing_switch_theme’ ); add_filter( ‘pre_option_stylesheet’, ‘yourthing_switch_theme’ ); function yourthing_switch_theme( $theme … Read more

How can I get wp_head() as a string instead of echoing it?

You can use PHP’s output buffering. WIth this you can write a wrapper for the get_head() function function wpse251841_wp_head() { ob_start(); wp_head(); return ob_get_clean(); } You can then use this as $data = array( ‘wpHead’ => wpse251841_wp_head(), ‘postContent’ => $post->post_content, ‘postContentFiltered’ => apply_filters( ‘the_content’, $post->post_content ) ); Reference: Output Control Functions

Enqueue scripts inside a class

You mean you call your class right before closing HTML tag? It is too late to enqueue scripts then. Don’t hook into wp_print_scripts to enqueue your scripts and styles. I just learned this today from Rarst. So change your init_hooks function to something like following: public function init_hooks() { add_action(‘wp_enqueue_scripts’, array(__CLASS__,’include_all_files’)); } Also you are … Read more

How to add default images for custom backgrounds?

if you are asking default background image for add_theme_support( ‘custom-background’); then it can be set using ‘default-image’ => get_template_directory_uri() . ‘/images/pattern.png’, complete code will look like below. $args = array( ‘default-color’ => ‘f0f0f0’, ‘default-repeat’ => ‘fixed’, ‘default-image’ => get_template_directory_uri() . ‘/assets/images/pattern.png’, ); add_theme_support( ‘custom-background’, $args );

Twenty Eleven home page show only excerpt

The template you’re actually after is “content.php” You’ll want to change this line: <?php if ( is_search() ) : // Only display Excerpts for Search ?> <div class=”entry-summary”> <?php the_excerpt(); ?> </div><!– .entry-summary –> <?php else : ?> <div class=”entry-content”> <?php the_content( __( ‘Continue reading <span class=”meta-nav”>&rarr;</span>’, ‘twentyeleven’ ) ); ?> <?php wp_link_pages( array( ‘before’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)