function getBrowser() { $u_agent = $_SERVER[‘HTTP_USER_AGENT’]; $bname = ‘Unknown’; $platform = ‘Unknown’; $version= “”; //First get the platform? if (preg_match(‘/linux/i’, $u_agent)) { $platform = ‘linux’; } elseif (preg_match(‘/macintosh|mac os x/i’, $u_agent)) { $platform = ‘mac’; } elseif (preg_match(‘/windows|win32/i’, $u_agent)) { $platform = ‘windows’; } // Next get the name of the useragent yes seperately and […]
For more code ideas go to my GitHub gists:
https://gist.github.com/johnnya23
Grid of Taxonomies
Some options to add a grid of taxonomy pages. The first doesn’t include pageing the second requires adding a second post type to hold the pages. // no pageing with this one function jma_series_grid ($atts){ ob_start(); extract( shortcode_atts( array( ), $atts ) ); $series_array = get_terms( ‘series’ ); foreach ($series_array as $series) {//get values from […]
Placeholder Text with jQuery
This is for the constant contact widget: jQuery(document).ready(function($){ /* Put any theme-specific JS here… */ $ccwidget = $( ‘.widget_sf_widget_constantcontact’ ); $ccwidget.find(‘label’ ).css(‘display’, ‘none’); $ccwidget.find(‘input[name=”fnm”]’ ).attr(‘placeholder’, ‘First Name’); $ccwidget.find(‘input[name=”lnm”]’ ).attr(‘placeholder’, ‘Last Name’); $ccwidget.find(‘input[name=”eml”]’ ).attr(‘placeholder’, ‘Email’); });
Font Awesome Bullets for List Items (pdf list)
/* pdf list */ ul.pdf-list li { list-style-type: none; position: relative } ul.pdf-list li:before { display:block; position: absolute; font-family: ‘FontAwesome’; content: ‘\f1c1’; left: -20px; color: #990000; } #custom-main ul li, #main ul li { list-style-type: none; position: relative } #main ul li:before, #custom-main ul li:before { display:block; position: absolute; font-family: ‘FontAwesome’; content: ‘\f054’; left: -17px; […]
Bootstrap Left-side Tabs
The css modifications to get tabs to the left for a standard framed tab block .tabs-left .tb-tabs-framed .tab-content { border-top-width: 1px; margin-left: 149px; } .tabs-left .nav-tabs { width: 150px; float: left; } .tabs-left .nav-tabs>li { border-left-width: 1px; float: none; } .tabs-left .nav-tabs>li.active { border-bottom-color: inherit!important; border-right-color: #fff; } [raw] [tabs style=”framed” nav=”tabs” tab_1=”Title #1″ tab_2=”Title […]
WPML Add Language Toggle
function languages_list_header(){ $languages = icl_get_languages(‘skip_missing=0&orderby=code’); if(!empty($languages)){ echo ‘<div class=”tb-wpml-flaglist-header”><ul>’; foreach($languages as $l){ if(!$l[‘active’] && !$l[‘missing’]){ echo ‘<li>’; echo ‘<a href=”‘.$l[‘url’].'”>’; echo icl_disp_language($l[‘native_name’], $l[‘translated_name’]); echo ‘</a>’; echo ‘</li>’; } } echo ‘</ul></div>’; } } function below_menu_html(){ echo ‘<div class=”below_menu_html”><div>’; echo languages_list_header(); echo ‘</div></div>’; } add_action(‘themeblvd_header_menu’,’below_menu_html’);
WPML Add Widget Area by Language
Add this function to your functions.php: function is_lang($search_lang){ $return = false; $languages = icl_get_languages(‘skip_missing=0’); if(!empty($languages)){ foreach($languages as $lang => $l){ if($l[‘active’] && $lang == $search_lang){ $return = true; } } } return $return; } Then in the custom section of the new widget area (for JumpStart): is_lang(‘es’) for spanish (see languages and edit in the […]
Embed Font
@font-face { font-family: ‘WaterBrushROB’; /* Which font weight and style the file represents */ font-weight: normal; font-style: normal; /* For IE9 in Compatibility Mode */ src: url(‘./assets/fonts/water-brush-rob.eot’); src: /* For IE8 and older versions of IE */ url(‘./assets/fonts/water-brush-rob.eot?#iefix’) format(’embedded-opentype’), /* Super modern browsers */ url(‘./assets/fonts/water-brush-rob.woff2’) format(‘woff2’), /* All modern browsers */ url(‘./assets/fonts/water-brush-rob.woff’) format(‘woff’), /* For […]
Responsive Video
JumpStart and many themes have this built in, but just in case we ever need it. CSS: .video { position: relative; padding-bottom: 56.25%; padding-top: 20px; height: 0; overflow: hidden; } .video iframe, .video object, .video embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } HTML: <div class=”video”> <iframe width=”560″ height=”315″ src=”VIDEO […]