Skip to content

Instantly share code, notes, and snippets.

View Mamaduka's full-sized avatar

George Mamadashvili Mamaduka

View GitHub Profile
@Mamaduka
Mamaduka / ui-labs.php
Created March 23, 2011 11:21
I just rewrote John O'Nolan's UI Labs plugin. I think it would be more WordPress way to add CSS file admin head
<?php
/*
Plugin Name: UI Labs
Plugin URI:
Description: Experimental WordPress admin UI features, ooo shiny!
Author: John O'Nolan
Version: 1.0
Author URI: http://john.onolan.org
*/
@Mamaduka
Mamaduka / akismet-widget.php
Created April 7, 2011 20:24
I just recreated Akismet widget using WP_Widget class
<?php
/**
* Create widget for Akismet stats
*
* @package Akismet
*/
class Widget_Akismet extends WP_Widget {
function Widget_Akismet() {
<?php
/**
* Plugin Name: Post Meta for Events
* Plugin URI:
* Description: Add meta box to posts for events meta information ( using Kovshenin's Post Options API plugin )
* Version: 0.1
* Author: George Mamadashvili
*/
// Remove test options
@Mamaduka
Mamaduka / gist:1275029
Created October 10, 2011 10:51
Add parent category class to post_class() function
<?php
add_filter( 'post_class', 'mamaduka_add_parent_category_class' );
/**
* Add parent category class to post_class() function
*
* @link http://wordpress.stackexchange.com/q/23259#23260
*/
function mamaduka_add_parent_category_class( $classes ) {
global $post;
<?php
/**
* Filter chockout fields
*/
function pf_woocommerce_checkout_fields( $fields ) {
global $woocommerce;
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) :
if( ! in_array($values['product_id'], array(137, 139, 141) ) ) :
unset( $fields['account'] );
@Mamaduka
Mamaduka / gist:1894448
Created February 23, 2012 19:16
Separate WooCommerce Right Now dashboard widget.
<?php
/*
Plugin Name: Mamaduka WooCommerce Right Now Widget
Plugin URI: http://mamaduka.wordpress.com/
Description: Code for separated WooCommerce Right Now widget.
Version: 0.1
Author: George Mamadashvili
Author URI: http://mamaduka.wordpress.com/
*/
@Mamaduka
Mamaduka / gist:1909067
Created February 25, 2012 15:25
WooCommerce Right Now dashboard widget styles
#woocommerce_dashboard_right_now p.sub,
#woocommerce_dashboard_right_now .table,
#woocommerce_dashboard_right_now .versions {
margin: -12px;
}
#woocommerce_dashboard_right_now .inside {
font-size: 12px;
margin-bottom: 0;
padding-top: 20px;
}
@Mamaduka
Mamaduka / gist:1922991
Created February 27, 2012 10:24
Get minimal price
<?php
/**
* Grouped price display
*/
function mamaduka_wc_grouped_price_html( $price, $product ) {
$all_prices = array();
foreach ( $product->get_children() as $child_id ) {
$all_prices[] = get_post_meta( $child_id, '_price', true );
}
<?php
/**
* Returns the AJAX url
*/
function mamaduka_ajax_url() {
$scheme = is_ssl() ? 'https' : 'http';
return admin_url( 'admin-ajax.php', $scheme );
}
?>
@Mamaduka
Mamaduka / gist:2971897
Created June 22, 2012 10:24
Add excerpt and continue reading link to Woo - Tabs widget
<?php
function woo_widget_tabs_latest( $posts = 5, $size = 45 ) {
global $post;
$latest = get_posts( 'ignore_sticky_posts=1&numberposts='. $posts .'&orderby=post_date&order=desc' );
foreach($latest as $post) :
setup_postdata($post);
?>
<li class="fix">
<?php if ($size <> 0) woo_image( 'height='.$size.'&width='.$size.'&class=thumbnail&single=true' ); ?>
<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php the_title(); ?></a>