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

Change page template programmatically ?

It is possible using the template_redirect hook. Looks something like this : function language_redirect() { global $q_config; if( $q_config[‘lang’] == ‘en’ ) { include( get_template_directory() . ‘/page-template_en.php’ ); exit; } else { include( get_template_directory() . ‘/page-template_de.php’ ); exit; } } add_action( ‘template_redirect’, ‘language_redirect’ ); Code is untested, but should look like that. See my similar … Read more

Check if is on child-page of a particular page

You can do that with $post->post_parent. You will have to check if child page’s parent is Services page. So this is how you will check it. I assumed 123 in following code is page ID of your services page. Replace it with actual ID. if ( 123 == $post->post_parent ) { ?> <div class=”col-md-2 col-sm-4″> … Read more

How to configure WordPress to handle 75,000 pages?

The problem comes from the fact that, in order to display pages and their hierarchy, WP has to load all of them and then build the tree in memory. So, you are saved if you can convert most of those pages into one or several non-hierarchical custom post types. The permalink structure can be emulated.

How to load javascript on custom page template?

You can use is_page_template to check if you template is being used and load your scripts based on that ex: Add this code to your functions.php: add_action(‘wp_enqueue_scripts’,’Load_Template_Scripts_wpa83855′); function Load_Template_Scripts_wpa83855(){ if ( is_page_template(‘custom-page.php’) ) { wp_enqueue_script(‘my-script’, ‘path/to/script.js’); } }

How can I keep the content of my pages version controlled?

You already got something like this built in: Revisions. // Define the nr of saved revisions in your wp-config.php define( ‘WP_POST_REVISIONS’, 30 ); You can simply grab them by calling get_posts() with a post_type of revision. To show the difference between two revisions simply use wp_text_diff(). // Example $revisions = get_posts( array( ‘post_type’ => ‘revision’ … Read more

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