post_type) { case "song": require_once themeRootDir()."objects/song.class.php"; $CustomPost = Song::Get()->ByPost($post); break; case "album": require_once themeRootDir()."objects/album.class.php"; $CustomPost = Album::Get()->ByPost($post); break; case "bandmember": require_once themeRootDir()."objects/bandmember.class.php"; $CustomPost = BandMember::Get()->ByPost($post); break; case "gig": require_once themeRootDir()."objects/gig.class.php"; $CustomPost = Gig::Get()->ByPost($post); break; case "gear": require_once themeRootDir()."objects/gear.class.php"; $CustomPost = Gear::Get()->ByPost($post); break; default: require_once themeRootDir()."objects/coreobject.class.php"; $CustomPost = CoreObject::Get()->ByPost($post); break; } return $CustomPost; } function seoUrl($string) { $string = strtolower($string); $string = preg_replace("/[^a-z0-9_\s-]/", "", $string); $string = preg_replace("/[\s-]+/", " ", $string); $string = preg_replace("/[\s_]/", "-", $string); return $string; } function getBaseUrl() { return "/wp-content/themes/banddemo/bandmanager/"; } function getRelativePluginUrl() { return plugins_url()."/dx2bands/"; } function getPostBySlug($slug, $posttype = "post") { $post = null; try{ $args = array( 'post_type' => $posttype, 'numberposts' => 1, 'posts_per_page' => 1, 'post_status' => 'publish', 'name' => $slug ); $post = new WP_Query($args); } catch(Exception $e) { } return $post; } function getMultiplePosts($limit, $posttype="post") { $posts = null; try{ $args=array('post_type' => $posttype, 'post_status' => 'publish', 'posts_per_page' => $limit); $posts = new WP_Query($args); } catch(Exception $e) { } return $posts; } function validateMetaSave() { // Check if our nonce is set. if (!isset($_POST['customNBFieldsSaveMetaBoxNonce'])) return false; // Verify that the nonce is valid. if (!wp_verify_nonce($_POST['customNBFieldsSaveMetaBoxNonce'], 'customNBFieldsSaveMetaBoxData')) return; // If this is an autosave, our form has not been submitted, so we don't want to do anything. if (defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return false; // Check the user's permissions. if (isset( $_POST['post_type'] ) && 'page' == $_POST['post_type']) { if (!current_user_can( 'edit_page', $post_id )) return false; } else { if (!current_user_can( 'edit_post', $post_id ))return false; } //submission is valid and can continue return true; } function saveMetaField($post_id, $fieldname) { if(isset($_POST[$fieldname])) { update_post_meta($post_id, $fieldname, sanitize_text_field($_POST[$fieldname])); //echo "added $fieldname
"; } } function isLandscape($image) { list($width, $height) = getimagesize($image); //echo "Width : ".$width." - Height : ".$height; if ($width > $height) { return true; } else { return false; } } function getBMImageDir() { return "/wp-content/themes/banddemo/bandmanager/images/"; } function youtubeUrlToEmbed($string) { // return preg_replace( // "/\s*[a-zA-Z\/\/:\.]*youtu(be.com\/watch\?v=|.be\/)([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i", // "", // $url // ); $search = '/youtube\.com\/watch\?v=([a-zA-Z0-9]+)/smi'; $replace = "youtube.com/embed/$1"; $url = preg_replace($search,$replace,$string); return "
"; } function getPrettyDate($yyyymmdd, $showyear = true) { if($showyear == true) return date("F jS Y", strtotime($yyyymmdd)); else return date("F jS", strtotime($yyyymmdd)); } function generateCustomizerCSS() { $css = ""; ob_start(); if ( is_admin_bar_showing() ) echo ".navbar-fixed-top{margin-top:32px !important;}"; ?> @media (max-width: 768px) { #bs-example-navbar-collapse-1{background-color: !important;} } @media (max-width: 600px) { } .navbar-default{background-color: !important;} .navbar-nav li a:hover, .navbar-toggle:hover {color: !important;} .navbar-toggle{ border-color: !important;} .navbar-toggle:hover{background-color: !important;} footer{background-color:; border-top:px solid ;margin-top:15px;} footer, footer p{color:;} footer a{color:;} #brandhomelink{color:} .top-nav-collapse{background-color: !important; color:} .top-nav-collapse a, .top-nav-collapse #brandhomelink{color: !important;} .navbar-default .navbar-nav a{color: !important;} body, #content, #primary{background-color: !important; color: !important;} #postpagenav .page-numbers{color: !important; background-color: !important; border: 1px solid !important;} #postpagenav .nav-links .current{background-color: !important; color: !important;} article a, .entry-content a{color:;} article a:hover, .entry-content a:hover, #postbreadcrumbs a:hover{color: !important;} article h1, article h2, article h3, article h4, article h5{color:;} .navbar-nav .active a{background-color: !important; color: !important;} #sidebar h2{font-size:; color:;} #sidebar a{color:;} #sidebar a:hover{color: ;} #sidebar{color:; background-color:;} #postbreadcrumbs a{color: !important;}