How to add a breadcrumb to WordPress header?

I always like the non-plugin solution, even if it’s a hard one. To create a breadcrumb, you will need to functions. One, will create a chain of items ( such as categories ) for you. This will be used to form the breadcrumb later: function get_category_parents( $id, $link = false, $separator=”https://wordpress.stackexchange.com/”, $nicename = false, $visited … Read more

Difference between how to set path to the theme folder

‘template_url‘ / ‘template_directory‘ – URL of the active theme’s directory. Within child themes, both get_bloginfo(‘template_url’) and get_template() will return the parent theme directory. Consider echoing get_template_directory_uri() instead (for the parent template directory) or get_stylesheet_directory_uri() (for the child template directory). Source: https://developer.wordpress.org/reference/functions/bloginfo/ the function get_template_directory_uri() is the better one, if you want to support creating child … Read more

Get not the full path

You might want to use the media_media_sideload_image() function. This function will fetch an image from a URL and upload it for you. Take a look into this custom function: function upload_image_from_url($image_url, $post_id, $title) { $img_name = basename ($image_url); global $wpdb; $query = “SELECT post_id FROM {$wpdb->postmeta} WHERE meta_value=”$img_name””; $id = $wpdb->get_var($query); if (is_numeric($id)) { return … Read more

‘posts’ table should not store the absolute image path

Well, after a little research I realized that it is an (inconvenient) feature of WordPress to store the absolute path of the images and other files, something that I completely disagree with. In any case, I discovered this plugin https://wordpress.org/plugins/root-relative-urls/. It does not fix the urls of files already inserted, but it corrects those of … Read more

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