Change Facebook Open Graph Meta Tags For WordPress

The Facebook plugin for wordpress automatically inserts open graph meta tags into the web pages rendered by wordpress to make them a social entity. Since the plugin is general in nature, all tags are specified to be as the default ones.

But sometimes we get into a situation that we initially defined our webpage types which is different than the default ones (like what happened with us 🙂 ) and we dont see the social actions being published nicely or inaccurately to facebook. This may mean a loss of revenue or traffic to the site, as we are not able to harness the complete power of the social network. Also we may get errors when using the open graph debugger to check if the open graph tags are acceptable to facebook/ other social sites.

So the options are either we make changes in the facebook plugin files every time we update the same or the better one to make use of the fb_meta_tags filter provided by the plugin. Thats where we will be able to harness the full power of wordpress and once we have done this we need not do it over and over again, even after updating the facebook plugin.

The only thing you may have to do is to copy the following code at the end of your functions.php file or any of your plugin file. Please do make the small change for the APP_NAMESPACE:TYPE as indicated in the comments in the code.

/********change facebook open graph************
**************og:type meta tag**********************
* Add site-specific og:type meta tag for example og:type = preeti_blog:website
* in place of og:type = website (which is default)
*
* @param array $meta_tags an associative array of Open Graph protocol properties provided by facebook plugin
* @return array plugin default values with site-specific customized changes
* suggested by developers of http://preetisblog.com
*/
add_filter('fb_meta_tags', 'change_fb_meta_type');
function change_fb_meta_type($metatags) {
if (is_home()) //for changes on home page only, remove this 'if' for changing on all pages of your site
{
$metatags['http://ogp.me/ns#type'] = 'preeti_blog:website';
//here you replace preeti_blog:website with ur APP_NAMESPACE:TYPE
}

return $metatags;
}

Similarly you may also change other open graph meta tag values, as the argument $metatags is an associative array, which can be easily accesed by property values as index. As an example ‘type’ is shown in the code above. Also you may add additional tags to the array also.

Pls like/tweet/+1 us/ leave a comment to show your support for PreetisBlog

Happy publishing your wordpress site…..

Internet Connection Ok But No Content Use Public DNS

Many a times we run into a very unique problem wherein we see that though we are connected properly to our internet service provider (ISP), but we are able to access a few sites only while others may not load or return a “host not found at given address” error.

Typical symptoms of above problem will be”

1. The connection to the ISP is shown as connected on your PC.
2. If you are connected through ADSL modem, you see the DSL light glowing constantly as well as the internet LED blinking, showing internet activity OK.
3. You are able to see the web page of few sites, while others may not load at all.
4. Your internet access time is very slow for certain sites.
5. Till very recently you had a perfect internet connection and suddenly you are not able to access certain sites etc.

Above may be a result of improper DNS i.e. Domain Name Server settings in your network settings.
Generally we are provided with a DNS server setting which our PC fetches from the ISP at connection start up. God forbid if the ISP’s configured DNS server goes down, then you run into the above kind of problems.

Thats too much for the explaination of the problem, but whats the solution????

All you have to do is to set up your DNS entry to a public DNS may be one hosted by Google (at 8.8.8.8) and this is how you do it:

On Windows platform:

1. Open Network Settings in Control Panel.
2. Right Click and select properties on the network adapter, through which you connect to your ISP i.e. through which you access your internet connection. It can be the wireless adapter if you connect through wi-fi or LAN/ ethernet card if you connect through UTP cable.
3. A pop up window will show you certain properties of your network adapter. Scroll down till you see an entry “TCP/IP”. Select it and click on properties button below (which gets highlighted as you select “TCP/IP”)
4. Another pop-up window will show you the IP address and DNS settings.
5. Go down to the Domain Name Server (DNS) address. Generally it will be selected as “Obtain automatically from ISP”.
6. Change it to “Use following DNS server” and punch the following values into the address field:

8.8.8.8

7. Click on OK buttons till you reach back to the network connections window.
8. Now you may check for loading of websites in your browser, and the problem should be resolved.

Happy Surfing…..

How to recover Linux after installing Windows in a dual boot system……

If we install any Windows Operating System (Windows XP, Windows 7 etc) on a computer already having Linux based Operating System (Ubuntu, Kubuntu, Suse etc), the system is not able to boot into Linux based OS, as Windows installers overwrite the GRUB boot loader during installation. As a result we don’t get any option to select the operating system during boot up and system boots up into Windows straight away.

This may create a lot of panic in the mind of the user as there are fears of loosing complete Linux based installations. But no need to worry as the installed Linux based system is already there. What we need to actually do is to restore the GRUB in Linux mode.

For the above problem we need to do following:

Download SuperGRUB from http://www.supergrubdisk.org/.

Burn the ISO into a CD using a CD burner tool.

Make sure your system is set up to boot from the CD (in the BIOS set up).

Reboot your computer after placing the CD so burned, into the CD tray.

The computer will boot up from CD and will load GRUB 2 and show you a screen as shown below.

grub2 screenshot

Select the option named “Detect any Operating System” using arrow keys and press enter key.

Please wait for a while, during which the superGRUB searches for the installed operating systems.

It will show up a list of all the Operating Systems installed in your computer.

Select the latest version of Linux Kernel shown from the available choices using the arrow keys and then press enter.

And you will see your system booting up into your Linux installation.

After complete loading of the Operating System you see your familiar desktop. This was all fine to boot up your system once. But to have a permanent choice of the Operating Systems we need to Install and Update the GRUB on the hard disk drive.

For this please follow the relevant instructions for your relevant distribution of Linux. For example, you may use the following link for doing the same on Ubuntu….

Update Grub