Skip to content

Instantly share code, notes, and snippets.

💻
Fixing things

Jeffrey Pearce jeffikus

💻
Fixing things
Block or report user

Report or block jeffikus

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
@jeffikus
jeffikus / sensei-admin-access.php
Created Jan 31, 2013
Prevent Sensei Admin Access
View sensei-admin-access.php
add_action('admin_init', 'sensei_prevent_admin_access');
function sensei_prevent_admin_access() {
if ( ! is_ajax() && ! current_user_can('edit_posts') ) {
global $woothemes_sensei;
wp_safe_redirect(get_permalink(intval( $woothemes_sensei->settings->settings[ 'course_page' ] )));
exit;
}
}
View htmlentitiesjs.js
/**
* JS version of PHP htmlentities.
*
* @since 1.0.8
* @access public
*/
jQuery.fn.htmlentities = function( str ) {
return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}
@jeffikus
jeffikus / pagination.hbs
Created Sep 20, 2013
Ghost Custom Pagination Partial
View pagination.hbs
<nav>
{{#if pagination.prev}}<a class="prev" href="/page/{{pagination.prev}}" title="Previous">Previous</a>{{/if}}
{{#if pagination.next}}<a class="next" href="/page/{{pagination.next}}" title="Next">Next</a>{{/if}}
</nav>
@jeffikus
jeffikus / gist:6931237
Created Oct 11, 2013
Sensei Lessons Archive sort by Menu Order
View gist:6931237
/**
* sensei_filter_lessons_archive function.
* @access public
* @param mixed $wp_query
* @return void
*/
function sensei_filter_lessons_archive( $wp_query ) {
// Handle lesson archive page
if ( is_post_type_archive( 'lesson' ) ) {
@jeffikus
jeffikus / gist:7114667
Created Oct 23, 2013
Filter WordPress Registration URL
View gist:7114667
add_filter('register', 'my_custom_registration_link');
function my_custom_registration_link($link) {
if(!is_user_logged_in()) {
// In this example there is a page with slug 'register' so the url would be http://mysite.com/register
$link = '<div class="status register"><a href="' . site_url('register') . '">' . __('Register') . '</a></div>';
}
return $link;
} // End my_custom_registration_link()
@jeffikus
jeffikus / gist:9342341
Created Mar 4, 2014
Modify Features Post Type to only allow publicly queryable posts, but disable archive and single feature posts
View gist:9342341
add_action( 'init', 'modify_existing_post_type', 50 );
/**
* Modify Existing post type.
*
* @access public
* @param string $token
* @param string 'Features'
* @param string 'Features'
* @param array $supports
* @return void
@jeffikus
jeffikus / gist:b18a7d32736bc76e8609
Created Jul 18, 2014
Fix for deprecated function - get_theme_data() with wp_get_theme()
View gist:b18a7d32736bc76e8609
add_action( 'after_setup_theme', 'woothemes_setup' );
if ( ! function_exists( 'woothemes_setup' ) ) {
function woothemes_setup () {
// This theme styles the visual editor with editor-style.css to match the theme style.
if ( locate_template( 'editor-style.css' ) != '' ) { add_editor_style(); }
// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );
@jeffikus
jeffikus / gist:37dc918cecc9f5a5ecfa
Created Sep 15, 2014
For the Cause image slider full height - before
View gist:37dc918cecc9f5a5ecfa
$style = '';
$featured_height = '';
if ( '' != $image_bg ) {
if ( '' == $title && '' == $content && '' == $embed ) {
$featured_height_id = get_post_thumbnail_id();
$featured_height = wp_get_attachment_image_src( $featured_height_id, 'large' );
$featured_height = ' height: ' . $featured_height[ 2 ] . 'px;';
}
$style = ' style="background-size: cover; background-image: url(' . $image_bg . ');' . $featured_height . '"';
}
@jeffikus
jeffikus / gist:8661b9872dad343ac108
Last active Aug 29, 2015
For the Cause image slider full height - after
View gist:8661b9872dad343ac108
$style = '';
$featured_height = '';
if ( '' != $image_bg ) {
$featured_height_id = get_post_thumbnail_id();
$featured_height = wp_get_attachment_image_src( $featured_height_id, 'large' );
$featured_height = ' height: ' . $featured_height[ 2 ] . 'px;';
$style = ' style="background-size: cover; background-image: url(' . $image_bg . ');' . $featured_height . '"';
}
View gist:87b31c77cccbb89fcaa1
<?php
global $wpdb;
$ID = $_GET['ID'];
$sql = "SELECT post_title from $wpdb->posts WHERE ID = '$ID';";
?>
You can’t perform that action at this time.