View Cache Busting - forcing that annoying cache to redownload our assets
// Cache busting dynamically
function get_file_last_mod($filename) {
$filename = dirname(__FILE__) . '/assets/css/' . $filename;
if( file_exists($filename) ){
$version = date ("M d Y H:i:s.", filemtime($filename));
}else{
// manual cache busting
$version = 'V1.0';
}
return $version;
View BP Sitewide messages widget
add_action('widgets_init', create_function('', 'return register_widget("HNLA_bp_sitewide_messages_Widget");') );
class HNLA_bp_sitewide_messages_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'HNLA_bp_sitewide_messages_Widget', //the ID?
'HNLA BP Sitewide Messages', //the widget name
array( 'description' => __('Displays the BP admin \'all users\' sitewide messages', 'meson'), )
);
View hnla BP login form widget
add_action('widgets_init', create_function('', 'return register_widget("HNLA_loggin_Widget");') );
class HNLA_loggin_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'HNLA_loggin_Widget',
'BP Login, Logout form',
array( 'description' => __('Displays the standard BP login form and logged in avatar, logout link', 'hnla'), )
);
View BP User Account Links Shortcode
View Shortcode get_post mini-loop
/*
* Shortcode get_post loop
*
* Shortcode displays loops for categories in posts or pages.
* It takes params for cat ID, qnt, show_thumbs, show_excerpt & height / width.
*
* [hnla_cat_loop cat_id='4' qnt='4' show_thumb=true show_excerpt=true, height='120', width='120' ]
*
* If showing thumbnails additional markup elements wrap the title and excerpt to allow positioning to right side of
* floated thumbnail.
View BuddyPress username shortcode
/*
* Add BP username via a shortcode function
* Use in pages or posts?
* For no real reason one can pass a specific user id through
*/
function display_username_in_posts($atts) {
$bp = buddypress();
extract(shortcode_atts(array(
"id" => '',
), $atts));
View hnla-loggin-bp-sidebar-me
function hnla_bp_login_bp_sidebar_me() {
/**
* This function provides BP sidebar login form if logged out
* welcome message username & logout link if logged in,
* list of any new notification on your account,
* sitewide site notices if any posted by site admin.
*
* Add function to your function.php file
* call function in any sidebar file using:
*
View WP-dropdown-style-dropin
/*
* A basic dropdown set of styles for WP wp_nav_menu() / wp_pages_list()
* This dropin group of rulesets uses a top level selector nav#site-main which needs to be changed to suit or added to markup.
* There is a simple series of CSS Transitions to provide a little smoothness to the opening / closing of the menu and opacity * transitioned on the li elements.
* There are background colours added and obviously these are subjective and won't suit all themes so need changing
* There is a comlimentary JS snippet that just adds classes to hovered li elements and their parents, this is named in time * honoured manner as 'sfhover' it's real purpose used to be to provide support for IE but are also useful to provide xpath * navigation back up the li nodes and used here to add li backgrounds on all hovered elements parents. In addition the script * Adds a class 'has-child' to li elements having nested ul li children.
*/
/* Configure main menu dropdowns */
nav#site-main ul li {