Conditional tags inside a class

Your real problem is the god class. You put rendering, sanitation, validation, saving and fetching data, and registration into one class. Separate your tasks to make it it OOP, and let the main class be a very simple front controller that handles the initial registration only. Here is a rough start, illustrating how I would … Read more

Display sidebar if blog

There is no conditional tag for the blog page. You have to use both is_home() and is_front_page() to detect this page When you use is_home() and is_front_page(), you have to use them in the right order to avoid bugs and to test every user configuration: <?php if ( is_front_page() && is_home() ) { // blog … Read more

Will post_exists work for draft posts?

Yes, as post_exists(“great title”) runs the following SQL: SELECT ID FROM $wpdb->posts WHERE 1=1 AND post_title=”great title” so there’s no post status or post type restriction. Check the docs on post_exists() for more info. If you want to restrict by post type, you can use: $found_page = get_page_by_title( “great title”, $output = OBJECT, $post_type=”page” ); … Read more

wp_login Action hook with conditional tag

This should work for you, make sure that the user_login or user_id matches to the string you’re using in the condition. Try to do a var_dump($user_login); And about the function you’re using, you don’t need to grab the global or call get_current_user();, because the action you’re calling already pass two parameters to your function, the … Read more

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