How to get featured post title & image using JSON API?

I made a shortcut to my image by adding it directly to the API response. //Add in functions.php, this hook is for my ‘regions’ post type add_action( ‘rest_api_init’, ‘create_api_posts_meta_field’ ); function create_api_posts_meta_field() { register_rest_field( ‘regions’, ‘group’, array( ‘get_callback’ => ‘get_post_meta_for_api’, ‘schema’ => null, ) ); } //Use the post ID to query the image and … Read more

Featured image upload finished hook

There is a deault feature available on WP to crop image once you upload. You can edit the image you upload and can crop image with you preferences. How to crop rotate scale and flip images in wordpress WordPress by default is designed to generate 3 types of cropping of any uploaded images (Media) automatically … Read more

How can I display my featured image correctly inside my single posts?

As mentioned by Rahil Wazir, take that code snippet <?php the_post_thumbnail(); ?> away from single.php. Put following in your functions.php (at the bottom) add_filter(‘the_content’, ‘put_thumbnail_in_posting’); function put_thumbnail_in_posting($content) { global $post; if ( has_post_thumbnail() && ( $post->post_type == ‘post’ ) ) { the_post_thumbnail( ”, array( ‘style’ => ‘float:left;margin:15px;’ ) ); } return $content; } Change the … Read more

Featured image size in ADMIN panel?

You can filter ‘admin_post_thumbnail_html’ and replace the img element with a new one in the size you need. Everything else will get messy and might lead to side effects. Filtering image_downsize while watching for a size of 266×266 might affect images that are not meant to be shown in the metabox. Changing the size for … Read more

adding an id to the_post_thumbnail

Use get_the_post_thumbnail() instead. It allows you to pass in an array of attributes for the image tag that gets returned. For example: $attr = array( ‘id’ => ‘YOUR-UNIQUE-ID’, ); echo get_the_post_thumbnail( $id, ‘thumbnail’, $attr ); EDIT: I’m dumb. the_post_thumbnail() also lets you do that. Try passing the same args array I outlined as the second … Read more

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