How WordPress hashes passwords

I’m the author of the linked article (thanks for the shout-out, by the way). The WordPress function that does the hashing is wp_has_password() and, by default, it will run the password through 8 rounds whatever the “best” algorithm the server makes available to PHPass is. WordPress, again by default, uses MD5. However you can also … Read more

Convert thumbnail ID into image URL

There are two functions you can use for this: wp_get_attachment_url to get the full sized image or wp_get_attachment_thumb_url, which gets the url of the thumbnail of that attachment. Either function takes the attachment id as the sole argument: $attachment_id= 25; //Get the full url $url = wp_get_attachment_url( $attachment_id ); //get the thumbnail $thumb = wp_get_attachment_thumb_url( … Read more

Parse error: syntax error, unexpected T_FUNCTION

That is called an Anonymous Function and is only supported in later versions of PHP, specifically 5.3.0 and later. If I were a betting man I would say your server has an earlier version of PHP. Try this instead: /*Add meta boxes to contact page*/ function contact_metaboxes( \WP_Post $post ) { global $post; if( ! … Read more

woocommerce Product shortcode create [closed]

Hello Here is the Shortcode you can use this it will give you title link and image of product. Put this code in functions.php file of your theme. add_shortcode(‘product_data’,’custom_product_function’); function custom_product_function($atts) { $post_id = $atts[‘id’]; $title = get_the_title($post_id); $link = get_the_permalink($post_id); $image = get_the_post_thumbnail($post_id); $data=”<div><a href=””.$link.'”><p>’.$title.'</p></a>’. $image.'</div>’; return $data; } And then add the shortcode … Read more

Bestway to write php functions

The use of function_exists is a very bad habit that should simply be avoided in favor of using actions and filters. If you want child themes to be able to override some functionality you need to be very specific about which one and how, and function_exists is usually not specific enough for that.