7

There's a reason people say that you shouldn't download free themes from outside of wordpress.org, they might contain hidden surprises In your case, the theme inserts an advertisement at the beginning of the post content div: <div style="position:absolute;top:0;left:-9999px;">Want create site? Find <a href="http://dlwordpress.com/">Free ...


6

It appears that your site doesn't use the core WordPress Featured Image feature but instead uses a custom image field (probably from Advanced Custom Fields). Yoast's plugin, Jetpack, and presumably many others look for the Featured Image image when setting the opengraph meta tag. So you have two options: Use the core Featured Image feature with one of the ...


5

Fast 'n' Hacky The problem can be solved by changing line 319 in facebook.php to the following: if (is_home()) { This way, the front page is not treated as a home page but as a regular page, for which the facebook feature settings can be applied (and will be handled correctly). More Elegant/Complex Here is a non-hackish version. Put the following in ...


4

There is no built-in way to extract an image/image-src from the post body. If the images are attachments you can do it with get_children or WP_Query, and wp_get_attachment_image_src. function get_image_src_from_content_101578($content) { global $post; $args = array( 'post_parent' => $post->ID, ); $images = get_children($args); foreach ($...


4

Go to Settings > Sharing in your dashboard Sroll down until the "Button Style" option. Choose "Official Buttons". The Facebook Share button has now changed into a Facebook Like Button. Save your changes, and you'll be good to go! If you want to add a Facebook Share button next to the Like button, you can use the "Add a new service" option: In "Service ...


4

The wpseo_opengraph_image filter can only be used to modify the existing og:image. Otherwise, you will need to hook into the wpseo_opengraph action to add a different image. Here's an example of adding an image from a custom field on the post object (assuming you're using ACF here). function my_wpseo_opengraph() { global $post; if (isset($post)) { ...


4

Facebook caches the meta values for performance. So it is currently hosting an old version of the shared URL. You need to use the Facebook debugger, and Fetch new scrap info. This will update the stored meta values of the post. To confirm that it works, I have already fetched new data for the respective URL and this is how it looks when I share it on FB: ...


4

As was already stated, Facebook automatically detects images if the OG image tag is missing. However, in some cases, it might detect other images (e.g. not from your post but from other content). In that case, it can be useful to fetch a list of all images attached to the post and use the one you like, or, as you suggest, the first one. The example below ...


3

First, this isn't a WordPress specific question, it's a Facebook question. Secondly, Facebook caches pages, they don't crawl them on every submission. If you have a URL that has already been submitted to Facebook before, then they will have already crawled it for the OG data once before, and saved it to their cache. If you later change the OG data, they won'...


3

There are a number of explanations here: https://developers.facebook.com/docs/facebook-login/access-tokens The time it takes for your server to talk with facebook does contribute to a good amount of slowdown. So it depends on how intensely you plan to use the api. In that case, storing the key and other fb related user data can cut that cross-talk ...


3

you can make your own plugin, or just use it in your functions.php add_action('wp_head', 'dgsoft_fb'); function dgsoft_fb(){ if( is_single() ) { echo '<meta property="og:image" content="'. get_the_post_thumbnail_url(get_the_ID(),'full') .'" />'; } }


2

Figured it out with function postimage($size = 'thumbnail', $qty = -1) { if (is_single() && !is_home() && !wp_attachment_is_image()) { global $post;$images = get_children(array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'posts_per_page' => $qty, 'post_mime_type' => 'image') ); if ( $...


2

After some more thought, I got it figured out. It involves multiple functions to go through each step of the process, but here it is: https://gist.github.com/4355955


2

I don't have the plugin to test this, but looking at the lines to hack, as pointed by @tf: if ( is_home() || is_front_page() ) { $enabled_features = get_option( sprintf( $option_name, 'home' ) ); } else if ( is_archive() ) { // all archives wrapped in one option // is_post_type_archive || is_date || is_author || is_category || is_tag || is_tax ...


2

First line of the codex for get_content: Displays the contents of the current post. This template tag must be within The_Loop. Also, this line: <meta property="og:description" content="<?php string_limit_words(the_content(), 15);" ?> /> would need to get_the_content(), as the_content() will output, and you need to return. <meta ...


2

Three simple steps to generate a Facebook Avatar: Create an extra field in your comment form for the user's facebook profile (see e.g. WP Engineer for a code example and how to) If the user filled out this field, get the facebook avatar (see this question) Replace the WP avatar with your facebook avatar if a fb profile url is set All together in this Gist (...


2

I don't use this plugin, but it looks like this comment template is loaded with add_filter( 'comments_template', array( 'Facebook_Comments', 'comments_template' ) ); The simplified structure of this comment template looks like: if ( have_comments() ) : // ... wp_list_comments( $_comment_options ); // ... endif; $_facebook_comments = ...


2

The usage of curl in PHP is not considered good practice in WordPress. It comes with HTTP API to abstract network requests. It will use curl when available, but still work via other backends if it's not and allow you to use WP debug plugins to troubleshoot requests, such as Core Control.


2

How can i immidiately know if a user has posted a comment? There is a hook called "wp_insert_comment", that is executed right after the comment is added. This actions passes 2 arguements first the comment id and the second is the comment. How can i know which user is that? Well it depends on if the user is a registered subsriber of your blog. Use the ...


2

The accepted answer over on StackOverflow looks to be the best way to do this. You'll want to get into your header.php file to make these changes. https://stackoverflow.com/questions/6693499/how-can-i-set-a-website-image-that-will-show-as-preview-on-facebook Now if the image should change from post to post, I would probably write something using JQUERY to ...


2

Im no expert on this but here goes: After reading some code and doing a global search of the filter, its not a filter at all, the only time that filter is called is in a do_action // HOOKABLE: This action runs just before logging the user in (before creating a WP cookie) do_action( "wsl_hook_process_login_before_wp_set_auth_cookie", $user_id, $...


2

the_permalink() function doesn't return the post permalik, it prints the permalink. To assing the permalink value to $url variable you need to user get_the_permalink() instead: $url = get_the_permalink();


2

It's assumed that your images are Facebook Image Sharing Compliant in size and quality, and you are trying to share single posttype 'post' only from a single template (single.php), and you are storing your image as post thumbnail. The following code will grab the post thumbnail (size = large) of particular post and put that in the og:image meta tag on the &...


2

You can use media_sideload_image() which will take a link to a file and upload it to the media library. You do need to pass it some kind of $post_id @Sumit points out in the comments you could pass NULL into the $post_id field. media_sideload_image( $file_url, $post_id, $image_desc, $return ); If you need the uploaded image ID, take a look ...


2

The code you used should work. BTW to me, as the code is not working, the best approach would be to unset the og:url from Jetpack and do it on your own? I'm taking your code and adding mine and editing where necessary: <?php /** * Change HTTPS to HTTP * @param string $url Default URL. * @return string Modified URL. * ---------------------------...


2

I'd recommend checking out the following plugins: Yoast SEO Open Graph Protocol Framework Either one will take care of all of the Open Graph metadata. Once you have the plugin set up, you can simply go to your homepage and you will see a "Featured Image" widget: Pick your logo and you will see the og:image which is what Facebook uses to set the post image....


2

Note that Facebook is a registered oEmbed provider in the WordPress core. You could e.g. use the pre_oembed_result filter, before the HTTP request is made, to cancel it and override it to your needs. Here's an example for Facebook posts: add_filter( 'pre_oembed_result', function ( $result, $url, $args ) { // override the HTML result for Facebook ...


2

I use the WP-Members plugin (https://wordpress.org/plugins/wp-members/ ). It allows you to block/not block by default, and block/unblock individual pages. Works well for me. There are similar plugins available.


2

You can use order post meta to check order already there or not. try below code. let me know if this helps you. $order_id = $order->get_id(); $fbpixel = get_post_meta($order_id, 'fbpixel-'.$order->get_order_number(),true); if ( $order->get_subtotal() > 0 && ( empty( $fbpixel ) ) ) : update_post_meta($order_id, 'fbpixel-'.$order->...


1

You are probably using this code in your theme's header.php. When this file is loaded $post is not available yet (it'll be inside the Loop). So you'd need to declare before anything global $post;. But that's not the best approach. If you swap themes, what? Do it again? See: Where to put my code: plugin or functions.php? With the following plugin, we will ...


Only top voted, non community-wiki answers of a minimum length are eligible