Skip to content

Instantly share code, notes, and snippets.

/* EXAMPLE CUSTOM LOOP (WPQUERY) WITH PAGINATION */
function video_testimonial_loop() {
$per_page = 8;
$paged = get_query_var( 'page' );
$args = array (
'post_type' => 'defunktnutestimon',
'posts_per_page' => $per_page,
'paged' => $paged,
'meta_query' => array(
// Register horseraces
$args = array(
"labels" => array(
"name" => "Paardenrassen",
"singular_name" => "Paardenras",
"all_items" => "Alle paardenrassen",
"add_new" => "Voeg een paardenras toe",
"add_new_item" => "Voeg een paardenras toe",
"edit_item" => "Pas paardenras aan",
"new_item" => "Nieuw paardenras",
// Register training taxonomy
// Add new taxonomy, NOT hierarchical (like tags)
$labels = array(
'name' => __( 'Type training', 'taxonomy general name' ),
'singular_name' => __( 'Type training', 'taxonomy singular name' ),
'search_items' => __( 'Zoek in types training' ),
'popular_items' => __( 'Vaak gebruikte trainingtypes' ),
'all_items' => __( 'Alle trainingtypes' ),
'parent_item' => null,
'parent_item_colon' => null,
// add tag support to pages
function tags_support_all() {
register_taxonomy_for_object_type('post_tag', 'page');
register_taxonomy_for_object_type('post_tag', 'defunktnuvideos');
register_taxonomy_for_object_type('post_tag', 'defunktnuteam');
register_taxonomy_for_object_type('post_tag', 'defunktnutestimon');
register_taxonomy_for_object_type('post_tag', 'defunktnucourse');
register_taxonomy_for_object_type('post_tag', 'defunktnuhorses');
}
add_action('current_screen', "whats_my_hook" );
function whats_my_hook() {
global $page_hook;
echo "My page hook:" . $page_hook;
}
@dendeffe
dendeffe / gist:643ab9ae84312b2a0add
Created October 18, 2014 19:05
ACF-hook to filter the query of a posts field
function test_field( $args, $field, $post ) {
// modify the order
$args['orderby'] = 'date';
$args['order'] = 'DESC';
$args['posts_per_page'] = 2;
return $args;
}
add_filter('acf/fields/post_object/query/key=field_5442b71190417', 'test_field', 10, 3);
class WC_Gateway_BACS_custom extends WC_Gateway_BACS {
function __construct() {
parent::__construct();
}
/**
* Process the payment and return the result
*
* @access public
class WC_Gateway_BACS_custom extends WC_Gateway_BACS {
function __construct() {
parent::__construct();
}
/**
* Process the payment and return the result
*
* @access public
@dendeffe
dendeffe / SilverStripe Image template tags
Created April 27, 2011 10:32
Example of SilverStripe Image template tags
$Image.SetWidth(80) // returns a image 80px wide, ratio kept the same
$Image.SetHeight(80) // returns a image 80px tall, ration kept the same
$Image.SetSize(80,80) // returns a 80x80px padded image
$Image.SetRatioSize(80,80) // **New in 2.4** returns an image scaled proportional, with its greatest diameter scaled to 80px
$Image.PaddedImage(80, 80) // Returns an 80x80 image. Unused space is padded white. No crop. No stretching
$Image.Width // returns width of image
$Image.Height // returns height of image
$Image.Orientation // returns Orientation
$Image.Filename // returns filename
$Image.URL // returns filename
<?php
// Example of how to use a SilverStripe module: https://github.com/dendeffe/Def_MailTools
/****
/ CONFIG
***/
// You can do these config settings in mysite/_config.php