This file contains 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 | |
// Open your theme's functions.php file or create a custom plugin. | |
// Add the following code: | |
Add the following code: | |
function remove_custom_meta_boxes() { | |
// Example: remove the 'slugdiv' meta box from the post editor screen | |
remove_meta_box('slugdiv', 'post', 'normal'); |
This file contains 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 | |
// Register and enqueue Isotope script | |
// Place in theme functions file | |
function cwpai_enqueue_isotope_script() { | |
wp_enqueue_script('isotope', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js', array('jquery'), '3.0.6', true); | |
} | |
add_action('wp_enqueue_scripts', 'cwpai_enqueue_isotope_script'); | |
// Fetch Team Member posts | |
$args = array( |
This file contains 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
function shortcode_name_shortcode($atts) { | |
ob_start(); | |
get_template_part('my-shortcode'); | |
return ob_get_clean(); | |
} | |
add_shortcode('shortcode_name', 'shortcode_name_shortcode'); |
This file contains 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
// Use acf as image array | |
<?php | |
$image = get_sub_field('FIELD_NAME'); | |
$image_url = $image['sizes']['CUSTOM_SIZE']; | |
?> | |
<img src="<?php echo $image_url; ?>"> |
This file contains 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
add_shortcode('my-shortcode', 'my_shortcode_function'); | |
function my_shortcode_function($atts) { | |
ob_start(); | |
get_template_part('template-parts/my-shortcode'); | |
return ob_get_clean(); | |
} |
This file contains 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
// Restricts input for the given textbox to the given inputFilter function. | |
function setInputFilter(textbox, inputFilter, errMsg) { | |
["input", "keydown", "keyup", "mousedown", "mouseup", "select", "contextmenu", "drop", "focusout"].forEach(function(event) { | |
textbox.addEventListener(event, function(e) { | |
if (inputFilter(this.value)) { | |
// Accepted value | |
if (["keydown","mousedown","focusout"].indexOf(e.type) >= 0){ | |
this.classList.remove("input-error"); | |
this.setCustomValidity(""); | |
} |
This file contains 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
.row:after { | |
display: table; | |
content: " "; | |
clear: both; | |
} | |
.col1, | |
.col2, | |
.col3, | |
.col4, |
This file contains 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 | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.github.io | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
*/ | |
$args = array( |
This file contains 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 | |
/** | |
* Hide shipping rates when free shipping is available. | |
* Updated to support WooCommerce 2.6 Shipping Zones. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function my_hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); |
NewerOlder