Add rel to all images in a post

something like this can be useful: function image_tag($html, $id, $alt, $title) { return preg_replace(array( “https://wordpress.stackexchange.com/”.str_replace(‘//’,’//’,get_bloginfo(‘url’)).’/i’, ‘/s+width=”d+”/i’, ‘/s+height=”d+”/i’, ‘/alt=””/i’ ), array( ”, ”, ”, ‘alt=”‘ . $title . ‘”‘ ), $html); } add_filter(‘get_image_tag’, ‘image_tag’, 0, 4);

have_posts() return false on single post

Late answer but, one possible scenario this could be happening is if you register two custom post types with the same permalink slug. You can debug this by doing a var_dump of the global variable $wp_query. global $wp_query; var_dump($wp_query); Check to see if the post_type in the query matches the post type of the page … Read more

Loop inside page template not working

From https://wordpress.org/support/article/creating-a-static-front-page/, Posts Page: (if not already created) create an empty page. Give it a Title that will be used on top of your posts list. This step is mandatory as you are modifying the WordPress default setting. Any other content other than Title will no be displayed at all on this specific page. So, … Read more

Google Plus One script has quit working, now returns red flag

Google +1 is very easy to add to your site, you only need 2 things for a basic button. 1. Google’s JavaScript, make sure its is https not http! `<script type=”text/javascript” src=”https://apis.google.com/js/plusone.js”></script>` To add this to your site in your functions.php you can write, function google_plus_gp() { wp_register_script( ‘google-plus’, ‘https://apis.google.com/js/plusone.js’); wp_enqueue_script(‘google-plus’) } add_action (‘wp_enqueue_scripts’,’google_plus_gp’); 2. … Read more

What is the advantage of using home.php over index.php for the front page

If you look here [is_home vs is_front_page] you’ll see that is_front_page() is true regardless of what the homepage is set to in the WordPress settings. This means that if you don’t plan on releasing this publicly (i.e. short-run usage) then just having a front-page.php should suffice. is_home() is set based on your blogs page (which … Read more

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