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

How to display custom content in post with category XXX

yes you can do that. You can use get_category_link for it. if(): while(): the_content(); if(category == “category one”){ // Get the ID of a given category $category_id = get_cat_ID( ‘helper for category one’ ); //get_cat_ID(‘category_name’); // Get the URL of this category $category_link = get_category_link( $category_id ); // Print category link here } else{ display_nothink … Read more

How to organise post by category and date

Looking for the solution, I want to give more information about what I have done so far: My Actual configuration – WordPress : 3.8 – PHP : 5.3 – Theme : custom based on _s (underscore) – Hebergeur : local XAMPP My archive template <main id=”main” class=”site-main” role=”main”> <?php // get all the categories from … Read more