Creating and Displaying widget in your wordpress website

Widgets can be extremely useful and handy. Some theme allows you to create widget. But how do you place them in your theme? In this article we will provide you wordpress snippets on

  1. Registering or creating wordpress widget
  2. Integrating the widget in your theme

1. Register wordpress widget

/**
 * Register Widget Area.
 *
 */
function wpgyan_widgets_init() {
register_sidebar( array(
'name' => 'Header Sidebar',
'id' => 'header_sidebar',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'wpscube_widgets_init' );
Note: I have added prefix wpscube_ to function name at two places at top and at bottom.You can change to a prefix of your choice.
Please read wordpress codex on other customization you could do
https://codex.wordpress.org/Function_Reference/register_sidebar

2. Integrate widget in your theme

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('header_sidebar') ) :
endif; ?>

header_sidebar = widget name defined in step 1

No go to Appearance > Widgets you will see Header Sidebar on the right hand side. You can add any kind of widget to it

If you want to register multiple widget. Use the above code but keep the widget name unique

 

What type of branding do you need?

There are 4 types of branding. This infograph by hanoverresearch explains how to choose the branding architecture

  • House of Brands
  • Endorsed Brands
  • Sub Brands
  • Branded House

Types-of-branding-Brand-Architecture-Infographic  What type of branding do you need? Types of branding Brand Architecture Infographic

The parent theme is missing. Please install the * parent theme

You might get this error “the parent theme is missing. Please install the [theme name] parent theme.”

This happens when you have changed the name of your default folder. In order to get this working on your child them

 

Lets assume this is your folder structure

wp-content

myTheme

— style.css

/*
 Theme Name: myTheme2015
 Theme URI: #
 Author: Shovan Sargunam
 Author URI: http://shovan.co.uk
 Version: 4.2.1
 Description:
 */

– myThemeChild

— style.css

/*
 Theme Name: myTheme2015 Child
 Theme URI: #
 Description: Child theme for the myTheme2015
 Author:
 Theme URI: #
 Template: myTheme
 Version: 4.2
 */

 

Template: myTheme

should be folder name of  your parent theme. in this case myTheme and NOT myTheme2015 (which is theme name in style.css) this will get rid of the parent theme is missing. Please install the * parent theme error on wordpress.

Show App banner on iOS and Android

If you have an iOS or Android app you would want to show installation banner when users visit your website via mobile browser.

Detailed info below

—–

ios Small App banner

<meta name="apple-itunes-app" content="app-id=960174190">

Android Small App banner

<meta name="google-play-app" content="app-id=XXXXX">

ios Small App banner

Add the meta to the header part of your website and you are good to go. According to apple here is the detailed your you could use

<meta name=”apple-itunes-app” content=”app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL”>

app-id: (Required.) Your app’s unique identifier.

Go to your app url for example https://itunes.apple.com/us/app/tamilsoda-music-videos-independent/id960174190?mt=8

Your app id is the number followed by id. Its nine-digit number
affiliate-data: (Optional.)

If you are iTunes affiliate you could add your affiliate url here
http://www.apple.com/itunes/affiliates/

 

app-argument: (Optional.)

If you want users to go to certain page within the app you could use app argument code here

For example, if you add app-argument=http://mywebsite.com/reviews?123, the following code in your app’s AppDelegate could take the user directly to the review with ID 123 in your app:

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation {
    if ([[url path] isEqualToString:@"/reviews"]) {
    	ReviewViewController *viewController = [[ReviewViewController alloc] init];
    	viewController.reviewID = [url query];
        [self.navigationController pushViewController:viewController animated:NO];
    }
    return YES;
}

--

Android Small App banner

<meta name="google-play-app" content="app-id=XXXXX">

App ID is the id of your android app. Go to your app your for example https://play.google.com/store/apps/details?id=com.ying.tamilsoda

You app id is here is com.ying.tamilsoda

This has not been tested, please let us know if it does work more documentation on this section can be read here

http://developer.android.com/distribute/tools/promote/linking.html

Showing small app banner on chrome

Currently the above meta tags does not work on iOS chrome browser. Jasny has produces a workaround that will show small banner on iOS chrome browser

http://jasny.github.io/jquery.smartbanner/

When we tested it, app banner worked great on chrome browser. How ever on safari there was two banners, one banner from the meta tag and another from the smart banner.

Further reading

  • http://www.raywenderlich.com/80347/smart-app-banners-tutorial
  • https://developer.apple.com/library/mac/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html
  • http://jasny.github.io/jquery.smartbanner/
  • https://github.com/kudago/smart-app-banner
  • http://misha.beshkin.lv/add-app-install-banner-to-site/

Please follow us on Facebook and Twitter

ssh permission change ownership

If you want to change ownership of files and folder follow the following codes

1. List current folder and users/groups assigned to it

ls -l

 

2a. Use chown comment to change ownership

chown user.name /srv/foldername/

 

2b. If you want to change the ownership all files and folder add -R comment to it

chown -R user.name /srv/foldername/

 

2c. If you are unable to change the ownership you can use sudo command (sudo is for advance users, please check with your system admin before using this comment)

sudo chown -R user.name /srv/foldername/

Pager Turns Your Facebook Pages Into Full-Fledged Websites

Having a Facebook page can be fun but owning a website is really cumbersome. It is so easy to manage a Facebook page and post pictures, events and wall posts all the time. Pager is the perfect idea for small business owners who wish to turn their Facebook page into a website.

When you start the app, first you have to log in using your Facebook account. Then you’re presented with a list of your Facebook pages. You select a page, save and your site is live in no time. We have to wait a little to get updates on Pager, as this hack was developed in 24 hours at NY Hackathon.

Pager sorts everything into four categories — About, News, Events and Galleries. The About page presents all your business’s contact info, opening hours, the news page has your wall posts, and events and galleries will have the images posted by you.

  • https://github.com/antonshevchenko/pager
  • https://pagerapp2.localtunnel.me

Posture.io helps you to Stop Slouching At The Desk

Heenan’s Posture.io demonstrated at the Disrupt NY Hackathon combines a Bluetooth Low Energy sensor attached to the back of an office chair with velcro and an adhesive magnetic rubber strip that’s stuck to the back of the wearer’s belt. The sensor detects the distance and angle of the magnetic strip on the belt to find whether the wearer is slouching or sitting up straight.

Posture-io Posture.io helps you to Stop Slouching At The Desk Posture.io helps you to Stop Slouching At The Desk Posture io

The app uses that data for tracking the wearer’s posture score and encourages them to slouch less. The wearer’s goal is to keep the posture score as close to 100 as possible.

Within the app, Posture.io displays a large graphic of the user’s posture with their posture score and also integrates with the menu bar to display a discreet reminder of how the wearer is currently sitting.

Google plus sends its first tweet

It’s been nearly four years after Googleplus created a Twitter account. And Googleplus has sent its first tweet yesterday. Since the debut, the service has never gained the same attraction as Facebook or Twitter did.

The Twitter profile of Google Plus was created (@GooglePlus is the handle) in July 2011.

In March Google announced that it would dismantle the service into two separate products: streams and photos. The Google plus split news was not a surprise to it’s users since it was so evident that it was not in the league with Facebook and Twitter that had 1.44 billion, 302 million user base. So why a tweet now?! is the big question.