Skip to content

Instantly share code, notes, and snippets.

View nickkuijpers's full-sized avatar

Nick Kuijpers nickkuijpers

View GitHub Profile
@nickkuijpers
nickkuijpers / index.php
Created January 7, 2015 12:33
Wordpress: Post base
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
@nickkuijpers
nickkuijpers / index.php
Last active August 29, 2015 14:13
Wordpress: Get Custom Posts
<?php
$loop = new WP_Query(
array(
'post_type' => 'posts',
'posts_per_page' => 9999
)
);
$i = 0;
while ( $loop->have_posts() ) : $loop->the_post();
@nickkuijpers
nickkuijpers / gist:13cfe0118ae58666c7d7
Created February 2, 2015 17:31
Gravityform CSS Bootstrap
.gform_wrapper ul {
padding-left: 0;
list-style: none
}
.gform_wrapper li {
margin-bottom: 15px
}
.gform_wrapper form {
margin-bottom: 0
}
@nickkuijpers
nickkuijpers / gist:70ab95eff21bde499f85
Created February 3, 2015 16:55
Wordpress Gravityforms Change class of submitbutton
// filter the Gravity Forms button type
add_filter("gform_submit_button", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
return "<button class='btn btn-primary' id='gform_submit_button_{$form["id"]}'><span>VERZENDEN</span></button>";
}
@nickkuijpers
nickkuijpers / gist:d3f5723c9f7016f29369
Created February 24, 2015 08:50
Wordpress PHP Get current product category
global $post;
$terms = get_the_terms( $post->ID, 'product_cat' );
foreach ($terms as $term){
$product_cat_id = $term->term_id;
$product_cat_name = $term->name;
break;
}
@nickkuijpers
nickkuijpers / gist:21766f42cf8989b2c01e
Created March 24, 2015 10:07
.htaccess redirection
Redirect 301 /path http://newdomain.com
@nickkuijpers
nickkuijpers / gist:ec3daaa88a021d81e8d7
Created March 29, 2015 20:41
jQuery Make sure all JS is loaded before executing
document.addEventListener( "DOMContentLoaded", function() {
JS
}, false );
@nickkuijpers
nickkuijpers / gist:60791e65ec0670bdd952
Created April 5, 2015 19:05
.htaccess HTTPS 2 HTTP Redirection
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
@nickkuijpers
nickkuijpers / gist:2c6d11921bd40d6497e3
Created April 12, 2015 10:58
WooCommerce Rating HTML
/**
* Change WooCommerce rating output
*/
add_action('woocommerce_after_shop_loop_item', 'get_star_rating' );
function get_star_rating()
{
global $woocommerce, $product;
@nickkuijpers
nickkuijpers / gist:4f6988646f24f8155302
Created April 12, 2015 12:53
WooCommerce get Attribute
global $product;
$merk = $product->get_attribute( 'pa_merk' );