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 | |
// change the checkout city field to a dropdown field | |
function nfh_change_city_to_dropdown( $fields ) { | |
$cities = array( | |
'', | |
'Nairobi', | |
'Nakuru', | |
'Eldorate', | |
'Mombasa', |
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_filter('acf/settings/remove_wp_meta_box', '__return_false'); |
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
//* From http://wpsnipp.com/index.php/functions-php/require-featured-image-can-publish-post/?utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+wpsnipp+%28wpsnipp+-+wordpress+code+snippets%29 | |
add_action('save_post', 'wpds_check_thumbnail'); | |
add_action('admin_notices', 'wpds_thumbnail_error'); | |
function wpds_check_thumbnail($post_id) { | |
// change to any custom post type | |
if(get_post_type($post_id) != 'post') | |
return; | |
if ( !has_post_thumbnail( $post_id ) ) { | |
// set a transient to show the users an admin message | |
set_transient( "has_post_thumbnail", "no" ); |
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 bd_nice_number($n) { | |
// first strip any formatting; | |
$n = (0+str_replace(",","",$n)); | |
// is this a number? | |
if(!is_numeric($n)) return false; | |
// now filter it; | |
if($n>1000000000000) return round(($n/1000000000000),1).' trillion'; | |
else if($n>1000000000) return round(($n/1000000000),1).' billion'; |
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 images to admin post object | |
function my_post_object_result( $title, $post, $field, $post_id ) { | |
if ($post->post_type == 'product') { | |
global $nf; | |
$title = '<div class="prodi" style="background-image: url(' . $nf->image(wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ), 140, 140) . ');"></div>' . $title; | |
$title = '<div class="prodc">' . $title . '</div>'; |
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
// ---- | |
// Sass (v3.4.9) | |
// Compass (v1.0.1) | |
// ---- | |
// and you can now also | |
.wrapper { | |
color: #000; | |