Get last post in category thumbnail

Try this: <?php $the_query = new WP_Query( ‘showposts=1&cat=55’ ); if($the_query->have_posts()) : while ($the_query -> have_posts()) : $the_query -> the_post();?>       <a href=”https://wordpress.stackexchange.com/questions/144864/<?php the_permalink(); ?>”><?php the_post_thumbnail();?></a> <?php endwhile; endif; /* Restore original Post Data */ wp_reset_postdata();?> Replace cat=55 with the category ID you want and/or replace showposts=1 with the number of latest posts you want to show … Read more

Retrieve a post’s featured image with PHP outside of WordPress

The most common way to achieve those features is to implement some sort of interface, usually in JSON or XML. To do this, you either use a plugin (http://wordpress.org/plugins/json-rest-api/ <= Will probably part of core in WP 4.0) or do the AJAX function yourself. An example would be: add_action( ‘wp_ajax_get_thumbnail’, ‘ajax_get_thumbnail’ ); add_action( ‘wp_ajax_nopriv_get_thumbnail’, ‘ajax_get_thumbnail’ … Read more

Comparison Operators not working for conditional author post thumbnails

You are using wrong Comparison Operators. Use else if($author_id == “2”) { instead of else if($author_id = “2”) { Edit: Try adding trailing slash after get_stylesheet_directory_uri function. its missing in your code. <img src=”https://wordpress.stackexchange.com/questions/166850/<?php echo get_stylesheet_directory_uri() ?>/images/default-thumb.jpg” alt=”” title=”” width=”” height=”” />

Unrestricted height thumbnails

According to add_image_size() you can do something like that with width but I imagine it works the same with height: $width (int) (optional) The post thumbnail width in pixels. Set to 9999 to resize based on $height Default: 0 Really I think you would want to set it to something ridiculously high which 9999 should … Read more

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