post_type)
return $post_id;
$meta_box_text_value = "";
$meta_box_textarea_value = "";
$meta_box_checkbox_value = "";
if(isset($_POST["is_featured"]))
{
$meta_box_checkbox_value = $_POST["is_featured"];
}
update_post_meta($post_id, "is_featured", $meta_box_checkbox_value);
}
add_action("save_post", "blognowlite_save_custom_meta_box", 10, 3);
endif;
/**
* Display the first (single) category of post.
*/
if ( ! function_exists( 'blognowlite_first_category' ) ) :
function blognowlite_first_category() {
$category = get_the_category();
if ($category) {
echo 'name ) . '" ' . '>' . $category[0]->name.' ';
}
}
endif;
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
if ( ! function_exists( 'blognowlite_categorized_blog' ) ) :
function blognowlite_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'blognowlite_categories' ) ) ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( array(
'fields' => 'ids',
'hide_empty' => 1,
// We only need to know if there is more than one category.
'number' => 2,
) );
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'blognowlite_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so blognowlite_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so blognowlite_categorized_blog should return false.
return false;
}
}
endif;
/**
* Flush out the transients used in blognowlite_categorized_blog.
*/
if ( ! function_exists( 'blognowlite_category_transient_flusher' ) ) :
function blognowlite_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'blognowlite_categories' );
}
add_action( 'edit_category', 'blognowlite_category_transient_flusher' );
add_action( 'save_post', 'blognowlite_category_transient_flusher' );
endif;
/**
* Add link to Admin Bar.
*/
if ( ! function_exists( 'blognowlite_custom_toolbar_link' ) ) :
function blognowlite_custom_toolbar_link($wp_admin_bar) {
$args = array(
'id' => 'happythemes',
'title' => '→ WordPress Themes',
'href' => 'https://www.happythemes.com/wordpress-themes',
'meta' => array(
'class' => 'happythemes',
'title' => 'Click to get more WordPress themes',
'target'=> '_blank',
)
);
$wp_admin_bar->add_node($args);
}
add_action('admin_bar_menu', 'blognowlite_custom_toolbar_link', 999);
endif;