functions.php and conditional tags

functions.php is part of the loading process and way too early for conditional tags to work reliably. Any conditional logic should be hooked to and executed no earlier than template_redirect hook. For scripts on front-end wp_enqueue_scripts is appropriate hook.

Conditional tags help (if none, don’t display anything)

For the pingbacks ul & h2 you’ll have to move it inside your mytheme_comments function, which should be in your themes functions.php file. The tags are a bit easier, you just need to them inside the php: <?php the_tags(‘<div class=”postTags”>’,’ ‘,'<br /></div>’); ?> So it won’t show an empty div when there aren’t any tags.

TinyMCE Buttons on Certain Post Type

This is used in one of my plugins and working well, hopefully it can draw some inspiration: public function efpd_run_tinymce(){ global $typenow, $pagenow; if ( empty( $typenow ) && !empty( $_GET[‘post’] ) ) { $post = get_post( $_GET[‘post’] ); $typenow = $post->post_type; } $curpage = $pagenow . ‘post-new.php?post_type=” . $typenow; if( “fanpages’ == $typenow || … Read more

Is there any way to assign stylesheets to whole sets of pages using is_page( )

Assuming that you’re using parent page “photos” as a path. It’s good practice (and required by WordPress Theme Guidelines) to use body_class() function for output different classes, based on current page or post. Just insert this function in your theme. <body <?php body_class(); ?>> This function will add parent-pageid-(id) class on every child page, cause … Read more

is_page() or is_single not working

The problem is probably because wp_print_scripts is too late to deregister scripts as this is when they are outputted to the template. You should consider using wp_enqueue_scripts or wp_register_script instead. This question may help: wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i’m confused

Conditional tags to differentiate between profiles and activity with buddypress [closed]

Your problem may be the choice of bp_is_user_profile(). This only returns true when you are literally looking at the xprofile component – the ‘Profile’ tab of a user’s page. bp_is_user() is more general, returning true whenever you’re viewing a user page (even if it’s user activity, user groups, etc). [EDIT] After further discussion with the … Read more

Different sidebars not changing

Your main problem is that the is_page() conditional will not return true if it is included inside or after the loop. Your other issue which is not necessarily related to the issue at hand is the way you are including your sidebars. WordPress comes with a handy little function called get_sidebar(). If you have more … Read more

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