Skip to content

Instantly share code, notes, and snippets.

add_filter( 'wp_nav_menu_items', 'custom_live_broadcast_menu_item', 10, 2 );
function custom_live_broadcast_menu_item ( $items, $args ) {
$terms = get_option('myBroadcastPlugin_settings');
$termsString = implode (',' , $terms);
if ($termsString == "enabled" && $args->theme_location == 'primary') {
$items .= '<li><a href="">Live Broadcast</a></li>';
}
return $items;
}
@farajoomla
farajoomla / dl-file.php
Created April 13, 2016 02:37 — forked from hakre/dl-file.php
Wordpress login to download uploaded files
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+
function echo_comment_id( $comment_id ) {
printf( 'Comment ID %s could not be found', esc_html( $comment_id ) );
}
add_action( 'comment_id_not_found', 'echo_comment_id', 10, 1 );