The Nutz
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Plugins
In reply to: [Page View Count] Manually Adding PHP Makes All Pages Count Together?I have this problem too but i solved like this
<?php $postid = get_the_id(); pvc_stats_update( $postid, 1 ); ?>Forum: Reviews
In reply to: [Add Meta Tags] 5 stars, but i have a but (everyone has, init?)..I modified a little bit your code because some posts from my webpage are created automatically and contain just photos. So i need the og:image meta tag to find these images and add them automatically.
I will share this code for those who need this function.
// Image if (function_exists('has_post_thumbnail') && has_post_thumbnail()) { $thumbnail_info = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail' ); $metadata_arr[] = '<meta property="og:image" content="' . $thumbnail_info[0] . '" />'; //$metadata_arr[] = '<meta property="og:image:secure_url" content="' . str_replace('http:', 'https:', $thumbnail_info[0]) . '" />'; $metadata_arr[] = '<meta property="og:image:width" content="' . $thumbnail_info[1] . '" />'; $metadata_arr[] = '<meta property="og:image:height" content="' . $thumbnail_info[2] . '" />'; } else { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){ $metadata_arr[] = '<meta property="og:image" content="' . trim($options["default_image_url"]) . '" />'; }else { $metadata_arr[] = '<meta property="og:image" content="' . $first_img . '" />'; } } if ( is_attachment() && wp_attachment_is_image($post->ID) ) { // is attachment page and contains an image $attachment_image_info = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large' ); $metadata_arr[] = '<meta property="og:image" content="' . $attachment_image_info[0] . '" />'; //$metadata_arr[] = '<meta property="og:image:secure_url" content="' . str_replace('http:', 'https:', $attachment_image_info[0]) . '" />'; $metadata_arr[] = '<meta property="og:image:width" content="' . $attachment_image_info[1] . '" />'; $metadata_arr[] = '<meta property="og:image:height" content="' . $attachment_image_info[2] . '" />'; }Forum: Plugins
In reply to: [Infinite-Scroll] Need CSS Selectors for Harimau Malaya theme.The theme is here http://demo.kreativethemes.com/harimaumalaya/
[ Please do not bump, that’s not permitted here. ]
Viewing 3 replies - 1 through 3 (of 3 total)