Skip to content

Instantly share code, notes, and snippets.

View foxydot's full-sized avatar

Catherine OBrien foxydot

View GitHub Profile
function remove_redirect_guess_404_permalink( $redirect_url ) {
if ( is_404() && !isset($_GET['p']) )
return false;
return $redirect_url;
}
add_filter( 'redirect_canonical', 'remove_redirect_guess_404_permalink' );
/**
* @desc Create content type
*/
function register_cpt_contest_entry() {
$labels = array(
'name' => _x( 'Contest Entries', 'contest-entry' ),
'singular_name' => _x( 'Contest Entry', 'contest-entry' ),
'add_new' => _x( 'Add New', 'contest-entry' ),
'add_new_item' => _x( 'Add New Contest Entry', 'contest-entry' ),
add_filter('filter_allowed_sorting_columns','msdlab_sort_by_title_allowed');
function msdlab_sort_by_title_allowed($allowed){
$allowed[] = 'media_title';
return $allowed;
}
@foxydot
foxydot / gist:fa10c980eef91338bc25
Last active August 29, 2015 14:15
quick cheat to get text list into format
<?php
$list = explode("\n",'test
list
here');
foreach($list AS $l){
$ret .= '
<li><i class="fa-li fa fa-angle-right"></i>'.$l.'</li>';
}
ts_data($ret);
?>
@foxydot
foxydot / script.js
Created February 5, 2015 05:35
tween progress of items on path
$(window).ready(function() {
var quantity = 30, //number of dots
duration = 3, //duration (in seconds)
path = [{x:100, y:0}, {x:200, y:100}, {x:100, y:200}, {x:0, y:100},{x:100, y:0}]; //points on the path (BezierPlugin will plot a Bezier through these). Adjust however you please.
<header class="row" id="header">
<div class="col-xs-12 top">
<div class="col-sm-6" id="logo">
<a href="/home.php">
<img src="http://pricedynamics.ro/images/logo-white.png">
</a>
</div>
<div class="col-sm-6">
<ul class="nav navbar-nav pull-right">
@foxydot
foxydot / leadership.less
Created October 28, 2014 18:12
Grid for content area.
//Goes in custom.less
.leadership{
.entry-content{
ul{
margin: 0;
li{
list-style: none outside none;
float: left;
width: 49%;
padding-top: 1.5rem;
@foxydot
foxydot / gist:4d9b298600c3e348af0a
Created October 17, 2014 20:35
Open Graph addition for WP.
/*** HEADER ***/
add_action('wp_head','msdlab_add_open_graph_meta',1);
/**
* Add new image sizes
*/
add_image_size('facebook', 200, 200, TRUE);
add_image_size('linkedin', 180, 110, TRUE);
/**
@foxydot
foxydot / gist:9099693
Created February 19, 2014 19:28
Filter out Better WordPress Security "bug"
<?php if (wpsc_have_custom_meta()) : ?>
<div class="custom_meta">
<?php while ( wpsc_have_custom_meta() ) : wpsc_the_custom_meta(); ?>
<?php if (stripos(wpsc_custom_meta_name(),'g:') !== FALSE || (stripos(wpsc_custom_meta_name(),'bwps') !== FALSE)) continue; ?>
<strong><?php echo wpsc_custom_meta_name(); ?>: </strong><?php echo wpsc_custom_meta_value(); ?><br />
<?php endwhile; ?>
</div><!--close custom_meta-->
<?php endif; ?>
@foxydot
foxydot / gist:9075575
Created February 18, 2014 17:29
wp_editor wpalchemy repeating
<?php
$mb->the_field('content');
$mb_content = html_entity_decode($mb->get_the_value(), ENT_QUOTES, 'UTF-8');
$mb_editor_id = sanitize_key($mb->get_the_name());
$mb_settings = array('textarea_name'=>$mb->get_the_name(),'textarea_rows' => '5',);
wp_editor( $mb_content, $mb_editor_id, $mb_settings );
?>