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 / cc.php
Created November 11, 2012 20:43
Clean Code
function horizontal_slider($args = array( )) {
?>
<a href="#" class="arrow prev"></a>
<div class="cycle-slideshow style-deck-slider">
<div class="slides">
<?php
//loop
$args = array(
'post_type' => 'h-slide',
'posts_per_page' => 999,
@gicolek
gicolek / custom_nav.php
Created November 11, 2012 21:42
Poprawiona klasa
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of exp_menu
*
@gicolek
gicolek / extra-category-meta.php
Created November 25, 2012 22:22
Extra Category Meta
<?php
// put that into functions.php or include via functions.php
define( 'RG_LOCALE', 'rg_locale' );
add_action( 'edit_category_form_fields', 'rgicgier_category_custom_fields', 10, 2 );
add_action( 'edited_category', 'rgicgier_save_category_fields', 10, 2 );
/**
* Facilitate obtaining of category meta
@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";
@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 / 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 / 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 / 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 );
<?php
/**
* Template name: Dla Arturq <3
*/
get_header() ?>
<?php the_post() ?>
<?php wpized_load_partial('breadcrumbs') ?>
@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":