How can I set a post thumbnail image without making a featured image?

This is your theme specific to show featured image in single post view. I think you’re using Modern Style theme, just remove following code from single.php on line 14, now featured images only will be shown on tag/category archive pages (and I think on main page too ). <?php if ( function_exists(“has_post_thumbnail”) && has_post_thumbnail() ) … Read more

Listing authors and date archive from custom post type

This should have been two different questions but anyway, I needed to use wp_list_authors for custom post type so i created this function: function get_authors_ids_by_post_type($type = null,$args=””){ if ($type === null) return; global $wpdb; $defaults = array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘number’ => ”, ‘optioncount’ => false, ‘exclude_admin’ => true, ‘show_fullname’ => false, … Read more

show only sub categories if available?

use a conditional statement, for example: $sub_cats = get_categories(‘parent=”.get_query_var(“cat’)); if( $sub_cats ) : //show list of child categories, for instance with wp_list_categories() echo ‘<ul>; wp_list_categories(‘title_li=&child_of=”.get_query_var(“cat’)); echo ‘</ul>’; //or possibly using $sub_cats and a foreach loop// echo ‘<ul>’; foreach( $sub_cats as $sub_cat ) { echo ‘<li><a href=”‘.get_category_link($sub_cat->term_id).'”>’.$sub_cat->name.'</a></li>’; } echo ‘</ul>’; else: //the ‘normal’ LOOP of category.php// … Read more

Archive limit the text of the_content

I’m assuming ‘Archive Page’ is a custom template and not either of the WP archive pages (category/date/author/tag/taxonomy). Try using this: <?php add_filter(‘the_content’, ‘trim_content’); function trim_content($content) { if(is_archive()) { //use your own trick to get the first 50 words. I’m getting the first 100 characters just to show an example. $content = (strlen($content) <= 100)? $content … Read more

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