how to add brand name with image at facebook page share content - wordpress

Sometimes we see some page post on my timeline, where website shareing link conatin a image, below part of image attach with a page brand name (i have atatch a image example below.). if you click on link you will go to the website page and you will not see the brand name with image. I think somehow this brand name added later by coding or other system. I am confirm, content uploader does not attach this brand name with image, it happen automaticaly.
there anyone please tell me the system nmae and how to do it? at word press how can do that? have any plugin or code? thanks in advance.

You have to add the meta property inside the header area of ​​your site. Please check below article to know more.
For Facebook
For Twitter
You can add meta properties like this.
add_action('wp_head','add_meta_tags');
function add_meta_tags() {
global $post;
echo '<meta property="og:title" content="'.$post->post_title.'" />';
// So on....
}

Related

Can I pass URL parameter values into webpage code to make the page display differently based on the URL Parameters? I.E. Embeded Google Drive Iframes?

I am but a human and I would like to pass URL parameters into a page's iFrame code to get a different Google Drive iFrame to show to different customers. The idea is that we will have just one page but different to the people who view them. Is that possible?
Like in the code:
<iframe src="https://drive.google.com/embeddedfolderview?(THIS BECOMES A DRIVE ID CUSTOM FIELD)#grid" style="width:100%; height:600px; border:0;"></iframe>
We want to deliver this link via email so when the user clicks the button it takes them to the page and loads the iframe with their folders on google drive in them.
the link on the email will be like:
https://customcreations.com/dashboard?driveID=(GOOGLE DRIVE ID TO POPULATE THE CUSTOM FIELD)
I am new sorry if this is not clear please let me know so I can clarify.
I tried having the id inside like a form that auto populates the iframe but it is breaking. I am really hoping this is possible.
Thank you to anyone who can help this mortal.
How about some php:
<?php
$drive_id = htmlspecialchars($_GET["driveID"]);
if (isset($drive_id)) {
// echo start <iframe> code here...
echo 'https://customcreations.com/dashboard?driveID=' , $drive_id;
// echo rest of <iframe> code here...
} else {
echo 'Invalid ID';
}
?>

remove and disable featured image in posts

I write a post in new post editor and then add media. I can see the images in the editor but when i publish them they aren't loading up and a frame with little square in the middle comes up. This is the link to one of my posts: http://getprogramcode.com/2013/03/c-program-for-bit-stuffing/ . For some people only link to the image comes up and it opens up with 404 error. See the line after OUTPUT: bit stuffing.
Also i want to remove the featured image from appearing in my posts. I have a option in my theme on a new post: "disable featured image" - but that doesnt work . Also if i dont put the image or i remove the featured image the empty image appears: see the home page: http://getprogramcode.com Please help me to solve this problem
You should not use relative paths on WordPress, only Absolute paths.
The problem is that you are using ../wp-content/... as your URL's for image paths.
When adding images, you should have the option to give it a path, you should opt to link to the media file.
For the disable feature image, if you go into the page.php or single.php code, it should have a line of code in it for calling in the featured image.
It should look something like this:
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
?>
You just need to remove or comment out this code and it should stop showing up on the pages.

The URL added while adding featured image in wordpress

I am working with wordpress latest version.
As in wordrpess, we can add URL while adding a featured image in a post as there are text fields like caption, title, alt text, description, URL etc.
I've added a link like http://example.com/abc-news
I am fine to show the featured image in the blog post but I want that link as
{featured-image}
So that, if anyone clicks on the featured image he/she will go to that link.
Any help would be appreciated.
If you are using the default theme with the latest version of WordPress, you can edit content.php in the 2014 theme directory.
You need to wrap <?php twentyfourteen_post_thumbnail(); ?> with the link code pointing to your URL.
This code should be around line 13 in content.php.
<?php twentyfourteen_post_thumbnail(); ?>
To link to the current blog post, you could add this code:
<?php twentyfourteen_post_thumbnail(); ?>
If you are using a different theme than the default, open the file which contains The Loop in your theme, search for the_post_thumbnail or a similarly named function, and change the code as above.
The exact answer will vary depending on theme, but 98% of the time the fix should be similar to the above. Hope this helps.
Edit: Here's some more information: http://codex.wordpress.org/Function_Reference/the_post_thumbnail#Post_Thumbnail_Linking_to_the_Post_Permalink
Thanks for your prompt reply.
You are right that it's 98% depending on the theme.
The theme is using a meta_value to add a custom URL for the featured image.
So, I need to get that URL through get_post_meta
I've got from here.
And I am fine with it now. :-)
Thanks

open graph image is loading properly for some pages but not others

This is the open graph image I want to load on all my pages shared on Facebook. It is loading properly on some pages and on others it is choosing a random image from the page. Below is the OG URL. I am using Drupal CMS for my site. All the proper code seems in place.
http://www.vaeducationoxnard.com/sites/default/files/styles/square_thumbnail/public/Charter%20Square%20Logo.png
This is because, facebook sends the whole new request to the url you are passing and because of this it gets the image from og:image in which you have passed the default image. To overcome this, try to aadd the image parameter in the url you are passing
Ex. your/url?imgToShare=
And in the main page from where you set the meta tags, add one condition
<?php
if(isset($_REQUEST['imgToShare'])
{
<set the meta tags for image you want>
}
else
{
<meta tag with the default image>
}
?>
This helped me.
Please comment if you have any doubts.

How would you recommend adding an image as a custom field in WordPress?

I need to add an image to each page in WordPress.
I don't wish to insert it using the WYSIWYG editor, I just need the url as a custom field, which I later use in the template.
I tried using the CFI plugin (Custom Field Images), and I hacked my way into getting it to work with the rest of my plugins, but then I moved the site to the production server and CFI just didn't work for some reason.
I can't seem to find any other plugin that just lets you pick an image from the library and add it as a custom field.
I've downgraded to the point where I'm willing to manually enter all the URLs into each and every page. but before I do, I thought I'd check here.
Can anyone tell me what's the easiest, best way to add images as custom fields in WordPress (2.7.1 if it matters)?
In our WordPress template, each post generally only has one image 'attached', which is displayed outside the posts' (textual) content.
I simply upload the file using the edit posts' media uploader, never insert it into the post like JoshJordan above, then retrieve the image using a bit of code in the right place in my template file.
This would also work if you're using more than one image in your post, eg. in your post content. As long as you keep the image used as the 'main' post image as the first image (remember you can re-order images in your posts' image library by dragging them up and down), you're easily able to call it anywhere in your template file by using something like this:
<?php
$img_size = 'thumbnail'; // use thumbnail, medium, large, original
$img_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts where post_parent= $post->ID and (post_mime_type = 'image/jpeg' OR post_mime_type = 'image/gif') and post_type = 'attachment'");
$img_array = wp_get_attachment_image_src($img_id,$img_size,false);
echo '<img src="'.$img_array[0].'"' title="'.get_the_title().'" />';
?>
No need for copying and pasting image urls.
The template I have uses a manually-entered custom field for the splash image of each post. When I'm done writing my article, I upload an image, copy its URL from the upload tool, never insert it into my post, and then paste that URL into the "Image" custom field. Simple as pie and takes only seconds. Insignificant compared to the amount of time it takes me to write an article.
You can use the custom key value fields on posts as well. let's say you always give your images the key 'thumb'. you can then use this code to output them in your post as a thumbnail:
<?php
$values = get_post_custom_values("thumb");
echo “<img src=\”$values[0]\” class=\”thumb\”></a>”; ?>
Consider using Flutter it's a bit tricky to figure out at first, and has many really useful featured, including EIP (edit in place), and image handling.
After installing the plugin create a new "Write Panel", you'll figure it out from there. The plugin provides you with a rather intuitive GUI, which includes an image uploader. The template tags are very easy to use, I believe it's something like
<?php echo get_image('name_of_field'); ?>
I just had to build a site for a client that needed the same feature, I ended up using Flutter.

Resources