Skip to content

Instantly share code, notes, and snippets.

InfoSciGeek infoscigeek

Block or report user

Report or block infoscigeek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@infoscigeek
infoscigeek / display-div-content
Created Dec 18, 2017
Using Javascript to load a new div without reloading the entire page.
View display-div-content
<a name="blogfeed"></a>
<div class="usbln-blog-toggle" aria-hidden="true">
<a class="usbln-blog-toggle-item" href="#blogfeed" onclick="toggleVisibility('usbln-dobe');">DOBE</a>
<a class="usbln-blog-toggle-item" href="#blogfeed" onclick="toggleVisibility('usbln-events');">Events</a>
<a class="usbln-blog-toggle-item" href="#blogfeed" onclick="toggleVisibility('usbln-news');">News</a>
<a class="usbln-blog-toggle-item" href="#blogfeed" onclick="toggleVisibility('usbln-partners');">Partners</a>
<a class="usbln-blog-toggle-item" href="#blogfeed" onclick="toggleVisibility('usbln-students');">Students</a>
<a class="usbln-blog-toggle-item" href="#blogfeed" onclick="toggleVisibility('usbln-videos');">Videos</a>
<a class="usbln-blog-toggle-item" href="#blogfeed" onclick="toggleVisibility('usbln-all');">All</a>
</div>
View new_gist_file.js
$(document).ready(function()
{
var option = 'coke';
var url = window.location.href;
option = url.match(/option=(.*)/)[1];
showDiv(option);
});
function showDiv(option)
{
$('.boxes').hide();
View new_gist_file.js
var UtmCookie;UtmCookie=function(){function UtmCookie(options){null==options&&(options={}),this._cookieNamePrefix="_uc_",this._domain=options.domain,this._sessionLength=options.sessionLength||1,this._cookieExpiryDays=options.cookieExpiryDays||365,this._additionalParams=options.additionalParams||[],this._utmParams=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],this.writeInitialReferrer(),this.writeLastReferrer(),this.writeInitialLandingPageUrl(),this.setCurrentSession(),this.additionalParamsPresentInUrl()&&this.writeAdditionalParams(),this.utmPresentInUrl()&&this.writeUtmCookieFromParams()}return UtmCookie.prototype.createCookie=function(name,value,days,path,domain,secure){var cookieDomain,cookieExpire,cookiePath,cookieSecure,date,expireDate;expireDate=null,days&&(date=new Date,date.setTime(date.getTime()+24*days*60*60*1e3),expireDate=date),cookieExpire=null!=expireDate?"; expires="+expireDate.toGMTString():"",cookiePath=null!=path?"; path="+path:"; path=/",cookieDomain=null!=domain?"; dom
View GetYoastData.php
<?php
/**
* Version: 3.0
* Date: 02/11/2016
* Source: https://deanandrews.uk/get-yoast-seo-data/
*
* Note:
* This code is provided "as is" and any expressed or implied warranties, including, but not limited to, the implied
* warranties of merchantability and fitness for a particular purpose are disclaimed.
* In no event shall the regents or contributors be liable for any direct, indirect, incidental, special, exemplary, or
View style.css
/*
Theme Name: USBLN
Theme URI: http://byerscreative.com
Author: Byers Creative
Author URI: http://byerscreative.com;
Description: USBLN is a responsive, accessible, high-resolution theme featuring custom header and custom link colors, large images, and easy to read typography that scales to fit all screens. Other features include keyboard accessible navigation, optional social menu, sidebar- and footer widgets, no-sidebar page template, Aside post format, and collapsible author profile box. USBLN is translation ready and ships in English with translations in Catalan, Chinese (simplified), Dutch, Finnish, French, German, Hungarian, Italian, Norwegian Bokmål, Persian, Russian, Spanish, Swedish, and Turkish.
Version: 2.0.3
License: GNU General Public License
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: usbln
View buttons.html
<div class="buttons">
<a href="#" onclick="toggleVisibility('Menu1');">Menu1</a>
<a href="#" onclick="toggleVisibility('Menu2');">Menu2</a>
<a href="#" onclick="toggleVisibility('Menu3');">Menu3</a>
<a href="#" onclick="toggleVisibility('Menu4');">Menu4</a>
</div>
<div id="Menu1">I'm container one</div>
<div id="Menu2" style="display: none;">I'm container two</div>
<div id="Menu3" style="display: none;">I'm container three</div>
@infoscigeek
infoscigeek / functions.php
Last active May 11, 2017
Category dependent post templates.
View functions.php
<?php
//by https://stanhub.com/about-stan-kostadinov/
//works as expected
function get_custom_cat_template($single_template) {
global $post;
if ( in_category( 'category-name' )) {
$single_template = dirname( __FILE__ ) . '/single-template.php';
}
return $single_template;
@infoscigeek
infoscigeek / functions.php
Created Apr 8, 2017
Order an archive page for a post category by a numeric custom field
View functions.php
<?php
/*Custom sort cateogry id 5 archive */
function isg_custom_property_archive( $query ) {
// only modify queries for category 5 if it exists
if ( !is_admin() && term_exists(5,'category') && $query->is_category(5)) {
$query->set('posts_per_page','-1');
$query->set('offset','0');
$query->set('orderby', 'meta_value_num');
$query->set('meta_key', 'price');
$query->set('order', 'DESC');
@infoscigeek
infoscigeek / mu-plugin.php
Created Mar 22, 2017
Disabling a plugin on certain pages using a MU plugin. Author: Kamil Grzegorczyk
View mu-plugin.php
<?php
/*
Plugin Name: Cart66 remover
Plugin URI: http://www.lowgravity.pl
Description: Removes cart66 plugin from pages which are not store pages
Author: Kamil Grzegorczyk
Version: 1.0
Author URI: http://www.lowgravity.pl
*/
@infoscigeek
infoscigeek / functions.php
Created Mar 22, 2017
Stop wp-emoji from firing
View functions.php
<?php
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
You can’t perform that action at this time.