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

prevent same wordpress post title

I recently ran into a similar issue (rather tackling how to reset slugs that are dirty after importing). This is a snippit of the code I used to reset the slugs: $wpdb->update( $wpdb->posts, array( ‘post_name’ => sanitize_title( $post_to_fix->post_title ) ), array( ‘ID’ => $post_to_fix->ID ), array( ‘%s’ ), array( ‘%d’ ) ); Primarily focus on … Read more

How to get the meta title of a page configured as blog (loop)

Ok, I found the method by myself. This is the code: //… elseif (is_page() || is_single()) { //Page and Post Title global $post; $metatitle = get_post_meta($post->ID, ‘metatitle_value_key’, true); if ($metatitle) { echo stripslashes($metatitle); } else { the_title(); } } elseif (is_home()) { //Using is_home for the blog page //And using get_queried_object $page_object = get_queried_object(); $metatitle … Read more

Changing title bar in browser window of theme “Encounters Lite”

Filter wp_title, get the current page title from your external app, and return that title. Sample code: add_filter( ‘wp_title’, function( $title ) { // check if it the correct page if ( ! is_my_external_app_page() ) return $title; return get_title_from_external_app(); }); The implementation details are up to you.