Target WooCommerce Product Gallery Image (rather than Featured Image) for og:image

You will need to use the methods on one of the WooCommerce product object for example: function insert_fb_in_head() { global $post; if ( !is_singular()) //if it is not a post or a page return; echo ‘<meta property=”og:title” content=”‘ . get_the_title() . ‘”/>’; echo ‘<meta property=”og:type” content=”article”/>’; echo ‘<meta property=”og:url” content=”‘ . get_permalink() . ‘”/>’; echo … Read more

Facebook “like” open graph meta in header.php

I have this class from a while ago which still works fine on posts and pages using admin_head action hook <?php /** * Simple facebook open graph class for WordPress * * @author Ohad Raz * @version 0.1 * */ class simple_open_graph{ /** * Holds the default image url * @var string * @since 0.1 … Read more

How to get full absolute url for post attachment?

esc_attr() might not be necessary on the url retrieved by wp_get_attachment_image_src. I have referred to a code example from the WordPress Codex page on wp_get_attachment_image_src and adapted the following code that works for me. global $post; $thumbnailSrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), ‘medium’); if ( $thumbnailSrc ) : echo ‘<meta property=”og:image” content=”‘.$thumbnailSrc[0].'”>’; endif; Edit: Since you are using … Read more

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