Skip to content

Instantly share code, notes, and snippets.

View gicolek's full-sized avatar

Rafał Gicgier - Certified Codeable Expert Developer gicolek

View GitHub Profile
@gicolek
gicolek / gf.php
Created January 14, 2013 12:11
Gravity Form filters
<?php
static function _modify_gravity_form_lead_detail_table($cat_id) {
global $wpdb;
$lead_details_table_name = RGFormsModel::get_lead_details_table_name();
// get new category name
$new_name = $_POST['name'];
// get db category name
@gicolek
gicolek / TinyMCE filter - add buttons
Created January 14, 2013 08:09
TinyMCE filter adding buttons
<?php
/**
* Filter TinyMCE styleselect dropdown
*
* @link http://codex.wordpress.org/TinyMCE_Custom_Styles
* @param array $init_array
* @return type
* @hook tiny_mce_before_init
*/
function wp_light_mce_before_init_insert_formats($init_array) {
@gicolek
gicolek / tinymce.php
Last active December 11, 2015 02:08
tinymce.
<?php
// alter tinymce body classes
function mss_tiny_mce_before_init($init_array) {
// accessing global variable post
global $post;
$title = strtolower ($post->post_title);
if($title=='home'){
$init_array['body_class'] = $post->post_title;
}
@gicolek
gicolek / artur.js
Created January 7, 2013 18:35
Arturos
<script>
{"st_editor":"Score - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.","ALL":600,"AL":"600","AK":"600","AZ":"600","AR":"600","CA":"600","CO":"600","CT":"600","DE":"600","DC":"600","FL":"600","GA":"600","HI":"600","ID":"600","IL":"600","IN":"600","IA":"600","KS":"600","KY":"600","LA":"600","ME":"600","MD":"600","MA":"600","MI":"600","MN":"600","MS":"600","MO":"600","MT":"600","NE":"600","NV":"600","NH":"600","NJ":"600","NM":"600","NY":"600","NC":"600","ND":"600","OH":"600","OK":"600","OR":"600","PA":"600","RI":"600","SC":"600","SD":"600","TN":"600","TX":"600","UT":"600","VT":"600","VA":"600","WA":"600","WV":
<?php
/**
* Template name: Dla Arturq <3
*/
get_header() ?>
<?php the_post() ?>
<?php wpized_load_partial('breadcrumbs') ?>
@gicolek
gicolek / meta-box-sample.php
Last active December 11, 2019 01:41
Sample Meta Box
<?php
/* 1. Back End Usage
---------------------------------------------------------------------*/
// add neccessary actions
// @see http://codex.wordpress.org/Function_Reference/add_action
add_action( 'add_meta_boxes', 'rg_add_custom_box' );
add_action( 'save_post', 'rg_save_postdata', 10, 1 );
@gicolek
gicolek / the_time.php
Created December 13, 2012 14:04
the_time() usage example
<?php
// bah
?>
<a href="#" title="<?php the_time('h:i a'); ?>" rel="bookmark">
<time class="entry-date" datetime="<?php the_time('c'); ?>"><?php the_time( 'jS F Y' ); ?></time>
</a>
@gicolek
gicolek / sample_shortcode.php
Created December 12, 2012 00:16
Sample Shortcode
<?php
function wp_light_advanced_text($atts, $content = null) {
extract( shortcode_atts( array(
'foo' => 'WPized Light by X-Team All Rights Reserved',
), $atts ) );
return "<div id='{$foo}'>" . do_shortcode( $content ) . '</div>';
}
add_shortcode( 'wp_light_advanced_text', 'wp_light_advanced_text' );
@gicolek
gicolek / wp_query.php
Created December 6, 2012 22:48
Sample WP_Query
<?php
$args = array(
'post_type' => 'slider',
'posts_per_page' => -1,
);
$slider_query = new WP_Query( $args );
?>
<?php if ( $slider_query->have_posts() ): ?>
<?php while ( $slider_query->have_posts() ): $slider_query->the_post(); ?>
@gicolek
gicolek / fancy-pants.php
Created November 27, 2012 15:00
Fancy Pants
$pattern = '/^(P|K)\w*/';
$replacement = 'Mr Fancy Pants';
$subject = "Powelski";
$return = preg_replace( $pattern, $replacement, $subject );
var_dump( $return );
$subject = "Kris";