What is the difference between a delegate and an NSNotification?

wallmobile

Delegates and NSNotifications can be used to accomplish nearly the same functionality. However, delegates are one-to-one while NSNotifications are one-to-many.

View original post

Advertisements

Adding Menu Descriptions in a WordPress Theme

WordPress 3.x menu has a very nice feature where you can add descriptions with each menu items. But this feature is hidden by default. When enabled displaying these description is not supported sometime in few themes.

These menu descriptions provides a better user experience on your website and these descriptions can be used to show visitors more about a menu item.

Most of the themes are not designed with menu-item descriptions but here We can guide you how to enable menu descriptions in WordPress and how to add each menu descriptions in your WordPress theme.

You can follow these simple steps to show menu description for your WordPress theme:

1. Go to Menu section and click on screen option in top right.

2. Tick the checkbox of description and click back on screen option to close it.

3. You will see a description box with each of your menu item, so you can add what you want there.

wp-menu-descriptions

These descriptions will not show in front of your website so to display menu descriptions we will have to add some custom code.

4. Add this custom code in functions.php file of your current theme. This Walker class extends the existing class in WordPress and it adds code to display menu item descriptions.


class Description_In_Menu extends Walker_Nav_Menu {

 function start_el(&$output, $item, $depth, $args) {

 global $wp_query;
 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';

 $class_names = $value = '';

 $classes = empty( $item->classes ) ? array() : (array) $item->classes;

 $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
 $class_names = ' class="' . esc_attr( $class_names ) . '"';

 $output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';

 $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
 $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
 $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
 $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';

 $item_output = $args->before;
 $item_output .= '<a'. $attributes .'>';
 $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) .   $args->link_after;

 $item_output .= '<br /><span class="sub">' . $item->description . '</span>';
 $item_output .= '</a>';
 $item_output .= $args->after;

 $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
 }
}

5. WordPress themes use wp_nav_menu() function to display menus. In header.php file of theme  and replace wp_nav_menu() function with this.


<?php $walker = new Description_In_Menu; ?>

<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu', 'walker' => $walker ) ); ?>

6. Lastly you can style your menu item description. The code we added above displays item descriptions like this.

$item_output .= '<br /><span>' . $item->description . '</span>';

and this code will be executed on browser like this
<li id="menu-item-01"><a href="http://www.vivacityinfotech.com/">Home<br /><span>Start here...</span></a></li>

Now you can add CSS in your theme’s stylesheet, similar to this but you can use like you want.

.menu-item {
  border-left: 1px solid #ccc;
}

span.sub { 
 color:#FFF;
 font-size:11px;
}

Some Basics of Microsoft Project Server

RightClickSP

So what exactly is Project Server?

[Note: This article is written without any specific reference to a particular version of Project Server, that is, Project Server 2010 or 2013. These are general concepts about Project Server]

Project Server is Microsoft’s Project Management software that allows one to do project management, portfolio management, work management and related things for an Organization.

Using Project Server, you can do project planning (deciding how much time, people, cost it will take to complete a project), create tasks, assign those tasks to resources (team members) and track those tasks.

What are the Components of Project Server?

At a very high level, Project Server is made up of a server component (the ‘server’ software) that can be accessed and operated from clients – either Project Professional (which is a desktop product) or Project Web App (which is a browser based software)

How do I use Project…

View original post 583 more words

PayPal Test payments in WooCommerce Plugin

The PayPal Sandbox is a place where you can test your shopping cart and other PayPal integrations in a realistic way, except that no money changes hands. This means you can test your PayPal processes in the Sandbox and know they will behave the same on the when you go live. You need to follwo these steps

1. Login to the PayPal developer website

Login to the PayPal developer website: http://developer.paypal.com. Use your PayPal username and password to login and navigate to Applications → Sandbox accounts.

2. Create Your Sandbox test accounts

Now You need to create 2 test accounts –
1 for the merchant (representing your shop’s PayPal account) and
1 for a buyer (representing a customer/buyer).

Click the Create Account button to create an account.

3. Configure WooCommerce PayPal settings

Now login to  your WooCommerce store. Navigate to your WordPress dashboard → WooCommerce → Settings → Payment Gateways → PayPal. Configure it like the following:

  1. Select checkbox: Enable PayPal standard
  2. Use the merchant test account email you created in Step 2 above for the PayPal & Receiver email
  3. Select checkbox: Enable PayPal sandbox, Save changes to save the settings.

Now you can do test purchase using the your buyer account on your store and make a purchase. When you click the Place Order button, you will be sent to test store on the PayPal Sandbox to make your payment.

You will see that it’s the test store because “test store” is appearing in the store name and the URL is http://www.sandbox.paypal.com. PayPal also add a Test Site to the top of the page. Login with the buyer test account and confirm the payment. Click the Return to merchant link to complete the order.

Congratulations! You have now made a test payment with PayPal – without using any real money.

PayPal-with-woocommerce