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 | |
$args = array( | |
'label' => '', // Text in Label | |
'class' => '', | |
'style' => '', | |
'wrapper_class' => '', | |
'value' => '', // if empty, retrieved from post meta where id is the meta_key | |
'id' => '', // required | |
'name' => '', //name will set from id if empty |
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 | |
if ( is_singular('product') ) { | |
global $post; | |
// get categories | |
$terms = wp_get_post_terms( $post->ID, 'product_cat' ); | |
foreach ( $terms as $term ) $cats_array[] = $term->term_id; |
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
//Only integer allowed | |
jQuery.fn.inputFilter = function(inputFilter) { | |
return this.on("input keydown keyup mousedown mouseup select contextmenu drop", function() { | |
if (inputFilter(this.value)) { | |
this.oldValue = this.value; | |
this.oldSelectionStart = this.selectionStart; | |
this.oldSelectionEnd = this.selectionEnd; | |
} else if (this.hasOwnProperty("oldValue")) { | |
this.value = this.oldValue; | |
this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd); |
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 | |
function remove_filters_with_method_name( $hook_name = '', $method_name = '', $priority = 0 ) { | |
global $wp_filter; | |
// Take only filters on right hook name and priority | |
if ( ! isset( $wp_filter[ $hook_name ][ $priority ] ) || ! is_array( $wp_filter[ $hook_name ][ $priority ] ) ) { | |
return false; | |
} | |
// Loop on filters registered | |
foreach ( (array) $wp_filter[ $hook_name ][ $priority ] as $unique_id => $filter_array ) { | |
// Test if filter is an array ! (always for class/method) |
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
.gform_wrapper { | |
form .gform_body .ginput_complex input[type=text] { | |
width:100% !important; | |
} | |
input, input[type=text], select, textarea { | |
width:100% !important; | |
@include box-sizing(border-box); | |
} | |
} |
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
import { Button } from '@wordpress/components'; | |
import { MediaUpload, MediaUploadCheck } from '@wordpress/editor'; | |
const ALLOWED_MEDIA_TYPES = [ 'audio' ]; | |
function MyMediaUploader() { | |
return ( | |
// will check user have permission to upload media | |
<MediaUploadCheck> | |
<MediaUpload |
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
/* | |
##Device = Desktops | |
##Screen = 1281px to higher resolution desktops | |
*/ | |
@media (min-width: 1281px) { | |
//CSS | |
At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)
Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.
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 | |
/* | |
Plugin Name: My WP-Cron Test | |
*/ | |
//activation of job | |
register_activation_hook(__FILE__, 'my_activation'); | |
add_action('hourly_job', 'do_hourly_job'); |
NewerOlder