Change the_title() of a page dynamically

I would use the is_page_template() conditional: if ( is_page_template( ‘page-courses.php’ ) ) { // The current page uses your // custom page template; // do something } Edit You would use this conditional inside your filter callback: function wpse83525_filter_the_title( $title ) { if ( is_page_template( ‘page-courses.php’ ) ) { return ‘Custom Title’; } return $title; … Read more

Check IF is a “single product page” and Check the “role” for a Redirect

Here is the result that works, I put in the condition : is_product() to check if is a single product page. And I changed in the add_action() : admin_init by wp function cm_redirect_users_by_role() { $current_user = wp_get_current_user(); $role_name = $current_user->roles[0]; if ( is_product() ){ if ( $role_name !== ‘customer’ && $role_name !== ‘shop_manager’ && $role_name … Read more

featured image as background image on pages

You need to echo the return value from wp_get_attachment_image_src(). It also returns an Array(), so you need to grab the needed part from that array. In this case it’s the first/0 value. Example: <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘full’ );?> <div id=”post” class=”your-class” style=”background-image: url(‘<?php echo $thumb[‘0′];?>’)”> <p>your text demo</p> </div>

How to disable posts and use pages only

You can simply hide the posts menu by adding the following to your functions.php file: function remove_posts_menu() { remove_menu_page(‘edit.php’); } add_action(‘admin_menu’, ‘remove_posts_menu’);

Customizing the URLs of WordPress Login and Sign-up Pages?

You can use a htaccess file to rename the login and registration addresses to easier to remember versions: http://wpguy.com/articles/an-easy-to-remember-login-address/ Using what was in that link we can further extend the simple login address into a simple signup and a simple register address as follows: RewriteRule ^login$ /wp-login.php [L] RewriteRule ^signup$ /wp-signup.php [L] RewriteRule ^register$ /wp-register.php … Read more

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