the_title() is not displaying over the_thumbnail

the_post_thumbnail() and get_the_post_thumbnail() will output the complete HTML for displaying that image. So this <img class=”img-responsive” src=”https://wordpress.stackexchange.com/questions/274181/<?php the_post_thumbnail(); ?>” alt=””> will be rendered to something like this <img class=”img-responsive” src=”https://wordpress.stackexchange.com/questions/274181/<img src=”…” alt=”..” class=”..”>” alt=””> which is not valid HTML and you can’t really tell how browsers will display this. Now you have 2 choices: Use … Read more

How to add gallery support in WordPress?

You can use gallery-metabox. Its open source and easy to use; https://github.com/zulfnore/gallery-metabox From Readme ; Include the gallery.php in your functions.php: require_once ‘gallery-metabox/gallery.php’; Specify where you want the gallery metabox to show on line 17 in gallery.php. You can pass an array to have it show up on multiple post types, custom post types are … Read more

How can i hide post without thumbnails/featured images from index pages?

You can manipulate the main WP_Query just before it asks the database for posts. Looking for an existing _thumbnail_id meta field should suffice, so using the pre_get_posts filter, something like this might work for you: add_action(“pre_get_posts”, function($query) { if(!is_front_page() || !$query->is_main_query()) { return; } if(!array_key_exists(“meta_query”, $query->query_vars)) { $query->query_vars[“meta_query”] = array(); } array_push($query->query_vars[“meta_query”], array( ‘key’ => … Read more

array set title and alt in the_post_thumbnail

Try using get_the_title instead of the_title – from the Function Reference: the_title – Display or retrieve the current post title with optional markup. get_the_title – Retrieve post title. You might notice that the_title says “Display or retrieve” – and it’s true, you can pass false to the third parameter of the_title to get it’s output … Read more

Add class to custom thumbnail

The third parameter you can pass to get_the_post_thumbnail is $attributes, which you can use to pass custom HTML attributes including classes. $thumbnail = get_the_post_thumbnail( get_the_ID(), // Post ID. ‘thumbnail’, // Image size. array( // Attributes ‘class’ => ‘my-custom class-names’, // Classes go here. ) ); Note that this will override the default image classes that … Read more

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