Get post title by Alphabet

You have two problems. First need to global $wpdb;. Then you are using the_title() and the_permalink() both of which automatically echo out a value. So you need to switch them to get_the_title() and get_permalink(). function get_post_by_alphabet($the_char){ global $wpdb; $first_char = $the_char; $postids=$wpdb->get_col($wpdb->prepare(” SELECT ID FROM $wpdb->posts WHERE SUBSTR($wpdb->posts.post_title,1,1) = %s ORDER BY $wpdb->posts.post_title”,$first_char)); if ($postids) … Read more

Easier URL to an image

This should do the job: <img src=”https://wordpress.stackexchange.com/questions/129493/<?php echo get_template_directory_uri(); ?>/images/logo.png”>

Transferring WordPress Instances

You need change URLs in the complete database, not just in the two tables in wp_options. See WordPress Serialized PHP Search Replace Tool | Interconnect and the docs at Moving WordPress « WordPress Codex