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 / 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';";
?>
View gist:2fe1317fac638e8c3ab6
<?php
$wpdb->prepare( "SELECT post_title FROM $wpdb->posts WHERE ID = %d ", $ID );
$wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s ", 420, 'Europe' );
?>
View gist:c920cbcc1581b0d974d5
<?php
global $wpdb;
$ID = "'; SELECT * FROM wp_users WHERE 1 = '1";
$sql = "SELECT post_title from $wpdb->posts WHERE ID = '$ID';";
?>
View gist:98d9b6e5528d19c7f5f0
<?php
// table, $data, $format
$wpdb->insert(
$wpdb->postmeta,
array(
'post_id' => '5',
'meta_key' => '_custom_meta_key',
'meta_value' => 'true'
),
array(
View gist:3fa2f751515af3360316
<?php
// table, $data, $where, $format, $where_format
$wpdb->update(
$wpdb->postmeta,
array(
'meta_value' => 'false'
),
array(
'post_id' => 5,
'meta_key' => '_custom_meta_key',
View gist:7202d2d0a2b9b04c4b2b
<?php
// table, $where, $where_format
$wpdb->delete(
$wpdb->posts,
array(
'ID' => 5
),
array(
'%d'
)
You can’t perform that action at this time.