Skip to content

Instantly share code, notes, and snippets.

@tiborp
tiborp / custom.php
Last active August 29, 2015 14:01
Numeric pagination Bootstrap style
<?php
/**
* Numeric Page Navigation Bootstrap Style
*/
function tibs_page_navi($before = '', $after = '') {
global $wpdb, $wp_query;
$request = $wp_query->request;
$posts_per_page = intval(get_query_var('posts_per_page'));
$paged = intval(get_query_var('paged'));
@tiborp
tiborp / gist:4705486
Last active December 12, 2015 03:18
Always show Kitchen Sink in WordPress WYSIWYG Editor (so you don't have to explain this to clients every time ;-))
<?php
// Always show Kitchen Sink in WYSIWYG Editor
add_filter( 'tiny_mce_before_init', 'yourprefix_unhide_kitchensink' );
function yourprefix_unhide_kitchensink($args) {
$args['wordpress_adv_hidden'] = false;
return $args;
}
@tiborp
tiborp / Genesis Custom Favicon
Last active December 14, 2015 08:08
functions.php
<?php
// Load custom favicon
add_filter( 'genesis_pre_load_favicon', 'custom_favicon_filter' );
function custom_favicon_filter( $favicon_url ) {
return CHILD_URL .'/images/favicon.ico';
}
@tiborp
tiborp / conditional-gf-notifications.php
Created March 12, 2013 11:43
Condtional auto-reply message for GravityForms
<?php
// http://www.gravityhelp.com/forums/topic/conditional-logic-for-user-notifications
// update the "2" to the ID of your form
add_filter('gform_pre_submission_filter_2', 'your_prefix_conditional_message');
function your_prefix_conditional_message($form){
// update the "7_1" following "input_" to the IDs of your fields
$choice1 = RGForms::post('input_7_1');
$choice2 = RGForms::post('input_7_2');
$choice3 = RGForms::post('input_7_3');
@tiborp
tiborp / functions.php
Last active December 17, 2015 03:58
Add custom image sizes to WordPress Media Uploader choices
<?php
/** Add Custom images sizes to Media Uploader */
add_filter( 'image_size_names_choose', 'your_image_size_names_choose' );
function your_image_size_names_choose( $sizes ) {
$sizes = get_intermediate_image_sizes();
$add_sizes = array();
<?php
add_filter( 'genesis_attr_content', 'yoast_schema_empty', 20 );
add_filter( 'genesis_attr_entry', 'yoast_schema_event', 20 );
add_filter( 'genesis_attr_entry-title', 'yoast_itemprop_name', 20 );
add_filter( 'genesis_attr_entry-content', 'yoast_itemprop_description', 20 );
add_filter( 'genesis_post_title_output', 'yoast_title_link_schema', 20 );
/**
* We'll use the post info output to add more meta data about the event.
@tiborp
tiborp / gist:7410531
Last active December 27, 2015 23:59
Dropdown with GravityForms
<?php
$select = '<select>';
$forms = RGFormsModel::get_forms( null, 'title' );
foreach( $forms as $form ):
$select .= '<option id="' . $form->id . '">' . $form->title . '</option>';
endforeach;
$select .= '</select>';
echo "GF dropdown: $select";
@tiborp
tiborp / style.css
Created November 12, 2013 13:59 — forked from WebEndevSnippets/style.css
4 column GravityForms CSS ready class
/* 4 column Gravity Forms custom ready class ------------------------------------------------------*/
.gform_wrapper .top_label li.gfield.gf_first_quarter,
.gform_wrapper .top_label li.gfield.gf_second_quarter,
.gform_wrapper .top_label li.gfield.gf_third_quarter,
.gform_wrapper .top_label li.gfield.gf_fourth_quarter {
margin:0 0 8px 0;
width:24%;
}
@tiborp
tiborp / template-tags.php
Created December 1, 2016 12:35
Nifty inline SVG's
<?php
/**
* Return SVG markup.
*
* @param array $args {
* Parameters needed to display an SVG.
*
* @param string $icon Required. Use the icon filename, e.g. "facebook-square".
* @param string $title Optional. SVG title, e.g. "Facebook".
* @param string $desc Optional. SVG description, e.g. "Share this post on Facebook".
@tiborp
tiborp / custom.php
Last active May 9, 2017 20:16
Dynamically add Bootstrap column classes to footer widgets, depending on how many widgets are present
<?php
// Dynamically add Bootstrap column classes to footer widgets, depending on how many widgets are present
add_filter('dynamic_sidebar_params','tibs_footer_sidebar_params');
function tibs_footer_sidebar_params($params) {
$sidebar_id = $params[0]['id'];
if ( $sidebar_id == 'sidebar-footer' ) {