Force CSS changes to “go live” immediately

<link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); echo ‘?’ . filemtime( get_stylesheet_directory() . ‘/style.css’); ?>” type=”text/css” media=”screen, projection” />

 

 

This automatically updates the ?12345678 ending part every time you modify the file. Boom. Now everyone instantly sees your changes.

Thickbox support in front end

Thickbox is as jQuery plugin that WordPress use as it’s main popup window or modal view. It’s already built-in in WordPress so why not use that in front end. No need to download or import any extra files.

 

Hook that with a function

 

add_action('init', 'myplugin_thickbox');
function myplugin_thickbox() {
	if (! is_admin()) {
		wp_enqueue_script('thickbox', null,  array('jquery'));
		wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0');
	}
}


To add Thickbox, we only need to add class=”thickbox” and it will automatically add the onclick trigger.


<a title="Title" href="http://vsjodha.com/wp-content/uploads/2012/02/google_uwt.png">Google search</a>

get custom menu items

add_filter(‘wp_nav_menu_items’, ‘wp_nav_menu_custom’, 10, 2);
function wp_nav_menu_custom($items, $args) {
if( $args->theme_location == ‘primary’ ) {

$menu_name = ‘primary’;
$locations = get_nav_menu_locations();
//echo ‘<pre/>’; print_r($locations); die;
$menu = wp_get_nav_menu_object(4, $menu_name );
$menuitems = wp_get_nav_menu_items( $menu->term_id , array( ‘order’ => ‘DESC’ ) );

foreach ( $menuitems as $item ){

$id = get_post_meta( $item->ID,’_menu_item_object_id’, true );
echo ‘<br/>’;
echo $id;
//$page = get_page( $id );
//$link = get_page_link( $id );
}

}
}