A Pen by David van den Bor on CodePen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.vscode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2018-09-21T04:37:54.337Z","extensionVersion":"v3.1.2"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** ---------------------------------------------------------------------------- // | |
* @group WooCommerce custom Query Loop | |
* @author @david | |
*/ | |
?> | |
<ul class="products"> | |
<?php | |
$args = array('post_type' => 'product', 'posts_per_page' => 50, 'product_cat' => 'trousers', 'orderby' => 'rand'); | |
$loop = new WP_Query($args); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author @david | |
* Wordpress excerpt lenght for global use, with automatic "read more" | |
* | |
*/ | |
function et_excerpt_length($length) { | |
return 120; | |
} | |
add_filter('excerpt_length', 'et_excerpt_length'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* -------------------------------------------------------------------------------// | |
* @group remove jquery migrate from header | |
*/ | |
add_filter( 'wp_default_scripts', 'remove_jquery_migrate' ); | |
function remove_jquery_migrate( &$scripts) | |
{ | |
if(!is_admin()) | |
{ | |
$scripts->remove( 'jquery'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** ---------------------------------------------------------------------------- // | |
@group Add custom post types to feed | |
@author @david | |
*/ | |
function add_custom_posts_to_rss_feed( $args ) { | |
if ( isset( $args['feed'] ) && !isset( $args['post_type'] ) ) | |
$args['post_type'] = array('post', 'paintings'); | |
return $args; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Use these constructions when you want to insert large pieces of HTML code | |
// in Wordpress posts (with buttons in the HTML tab of the Wordpress editor) Insert | |
// buttons will appear in the HTML tab of the Wordpress editor! | |
function load_my_quicktags_inline() { | |
if ( wp_script_is( 'quicktags' ) ) { ?> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is how you can insert pieces of HTML code into pages using jQuery | |
var dynamic_html = "<div><span>Highlighted</span><span>Author</span></div>"; | |
document.getElementByID("container").innerHTML = dynamic_html; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container { | |
max-width: 640px; | |
max-height: 640px; | |
margin: 0 auto | |
} | |
.google_map | |
{ | |
width: 100%; |