How to insert widget areas specific to certain pages (or posts, etc.)?

Use Conditional Tags to show content only if a certain condition is met. In your case, you’re probably looking to use is_front_page(). <aside> <ul> <?php if ( function_exists( ‘dynamic_sidebar’ ) ) { if ( is_front_page() ) { if ( ! dynamic_sidebar( ‘frontpage-widget-area’ ) ) { echo ‘<li>No sidebars for the frontpage.</li>’; // some default output … Read more

Filter out some plugin action in wp head / wp_footer

You can try this (untested): add_action( ‘wp_head’, function(){ // your conditions: if( is_home() || is_category() ) { // access the global SyntaxHighlighter object instantiated at ‘init’. global $SyntaxHighlighter; // remove your action hooks: remove_action( ‘wp_head’, array( $SyntaxHighlighter, ‘output_header_placeholder’ ), 15 ); remove_action( ‘wp_footer’, array( $SyntaxHighlighter, ‘maybe_output_scripts’ ), 15 ); } } ); to remove these … Read more

Post.php – Conditional statements for new post and edit post

edit.php is the post/page list, the post creation/editing screen are 2 separate files: post-new.php and post.php. so you can target using “load-$page” hook, e.g.: add_action( ‘load-post.php’, function() { // add metabox or whatever you want when EDITING post add_action( ‘add_meta_boxes’, ‘myplugin_meta_box_editing’ ); } ); add_action( ‘load-post-new.php’, function() { // add metabox or whatever you want … Read more

Conditional tag search-no-results

There is no conditional tag for no results on a search page, but you can create yourself one. You basically just have to check the value of $wp_query->found_posts, if it is 0, returns false, any other value, returns true function is_search_has_results() { return 0 != $GLOBALS[‘wp_query’]->found_posts; }

Do I need to include ‘else’ and/or ‘endif’?

You just need an else block: //templating syntax if($condOne): //do stuff if $condOne is true elseif($condTwo): //do stuff if $condOne is false and $condTwo is true else: //do stuff if both $condOne and $condTwo are false endif; //braces syntax if($condOne){ //do stuff if $condOne is true }elseif($condTwo){ //do stuff if $condOne is false and $condTwo … Read more

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