Skip to content

Instantly share code, notes, and snippets.

@psflannery
psflannery / remove_jetpack_styles.php
Created December 4, 2013 11:02
Remove Jetpack styles - list of enqueued jetpack stylesheets to remove if necessary. via - http://www.tjkelly.com/blog/remove-wordpress-jetpack-css/
function remove_jetpack_styles(){
wp_deregister_style('AtD_style'); // After the Deadline
wp_deregister_style('jetpack-carousel'); // Carousel
wp_deregister_style('jetpack-slideshow'); // Jetpack Slideshow
wp_deregister_style('grunion.css'); // Grunion contact form
wp_deregister_style('the-neverending-homepage'); // Infinite Scroll
wp_deregister_style('infinity-twentyten'); // Infinite Scroll - Twentyten Theme
wp_deregister_style('infinity-twentyeleven'); // Infinite Scroll - Twentyeleven Theme
wp_deregister_style('infinity-twentytwelve'); // Infinite Scroll - Twentytwelve Theme
wp_deregister_style('noticons'); // Notes
<?php
$rss = new DOMDocument();
$rss->load('http://wordpress.org/news/feed/');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
agent.set_proxy '78.186.178.153', 8080
page = agent.get('http://www.google.com/')
google_form = page.form('f')
google_form.q = 'new york city council'
<?phpfunction override_video_dimensions( $out, $pairs, $atts ) {
$out['width'] = '768'; $out['height'] = '583';
return $out;
}
add_filter( 'shortcode_atts_video', 'override_video_dimensions', 10, 3 );?>
$(document).ready(function () {
WebFontConfig = {
google: {
families: ['Chivo']
},
active: function() {
$('#archive').imagesLoaded(function(){
$('#archive').masonry({
itemSelector : '.item',
@psflannery
psflannery / jetpack_module_manual_activation.php
Created October 16, 2013 09:21
http://jetpack.me/2013/10/07/do-not-automatically-activate-the-widget-visibility-module/ This code can apply to any other module, and can be used as a replacement of the Manual Control plugin for example.
// To disable the auto-activation of Jetpack's Widget Visibility module:
add_filter( 'jetpack_get_default_modules', 'disable_jetpack_widget_visibility_autoactivate' );
function disable_jetpack_widget_visibility_autoactivate( $modules ) {
return array_diff( $modules, array( 'widget-visibility' ) );
}
// Or, to disable the functionality in your own plugin if the user activates it in Jetpack:
if ( ! class_exists( 'Jetpack' ) || ! Jetpack::is_module_active( 'widget-visibility' ) ) {
// It's not there, do as you like!
}
@psflannery
psflannery / jetpack_manually_select_publicize.php
Created October 16, 2013 09:17
http://jetpack.me/2013/10/15/ever-accidentally-publicize-a-post-that-you-didnt/ Ever accidentally publicize a post that you didn’t mean to? This snippet will prevent the connections from being auto-selected, so you need to manually select them if you’d like to publicize something.
add_filter( 'publicize_checkbox_default', '__return_false' );
@psflannery
psflannery / jetpack_fallback_image.php
Created October 16, 2013 09:15
From http://wordpress.org/support/topic/help-can-i-specify-a-defaultfallback-image?replies=1 Add a default fallback image to jetpack open graphif no image can be found in a post
function jeherve_custom_image( $media, $post_id, $args ) {
if ( empty( $media ) ) {
$permalink = get_permalink( $post_id );
$url = apply_filters( 'jetpack_photon_url', 'YOUR_LOGO_IMG_URL' );
return array( array(
'type' => 'image',
'from' => 'custom_fallback',
'src' => esc_url( $url ),
'href' => $permalink,
jQuery(document).ready(function($) {
//capture ipad device change
function doOnOrientationChange()
{
switch(window.orientation)
{
case -90:
case 90:
alert('landscape'); //debug
////add class to assist with libraries like Modernizr
var body = document.getElementsByTagName("body")[0];
var script = document.createElement('script');
script.type = "text/javascript";
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js";
body.appendChild(script);