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
# Change post_type value if targeting 'page' or a custom post type | |
# Change ALL posts status from 'publish' to 'draft' | |
UPDATE wp_posts SET post_status = 'publish' WHERE (post_type = 'post' and post_status = 'draft') |
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
/** | |
* Native XMLHttpRequest as Promise | |
* @see https://stackoverflow.com/a/30008115/933951 | |
* @param {Object} options - Options object | |
* @param {String} options.method - Type of XHR | |
* @param {String} options.url - URL for XHR | |
* @param {String|Object} options.params - Query parameters for XHR | |
* @param {Object} options.headers - Query parameters for XHR | |
* @return {Promise} Promise object of XHR | |
*/ |
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 | |
/** | |
* @fileoverview custom filter and search | |
* | |
* References | |
* @see http://michaelsoriano.com/how-to-create-an-advanced-search-form-for-wordpress/ | |
* @see http://wordpress.stackexchange.com/a/50051/36130 | |
* @see https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters | |
*/ |
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
/** | |
* Daisy chaining delays (setTimeout) using Promises | |
* | |
* Ex: delay(func1, 1000).delay(func2, 1000).delay(func3, 1000); | |
* | |
* @param {Function} cb - Callback function | |
* @param {Number} ms - Time delay (in milliseconds) | |
* @return chainable delay Promise (ie. delay(cb, ms).delay(cb, ms).delay(cb, ms)...) | |
* | |
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#Creating_a_Promise_around_an_old_callback_API |
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
[ | |
{ "name": "Status: Abandoned", "color": "#000000" }, | |
{ "name": "Status: Accepted", "color": "#009800" }, | |
{ "name": "Status: Available", "color": "#bfe5bf" }, | |
{ "name": "Status: Blocked", "color": "#e11d21" }, | |
{ "name": "Status: Completed", "color": "#006b75" }, | |
{ "name": "Status: In Progress", "color": "#cccccc" }, | |
{ "name": "Status: On Hold", "color": "#e11d21" }, | |
{ "name": "Status: Pending", "color": "#fef2c0" }, | |
{ "name": "Status: Review Needed", "color": "#fbca04" }, |
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 | |
/** | |
* Sets the post view count | |
* @params ($postID) Current post ID | |
*/ | |
function namespace_set_post_views($postID) { | |
$count_key = 'namespace_post_views_count'; | |
$count = get_post_meta($postID, $count_key, true); |
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
<!DOCTYPE html> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]--> | |
// ... | |
</html> |
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
/** | |
* Triangle CSS Shape | |
* https://css-tricks.com/examples/ShapesOfCSS/ | |
* @usage @include triangle('down', 10px, #111) | |
*/ | |
@mixin triangle ($direction: 'up', $size: 100px, $color: red){ | |
width: 0; | |
height: 0; | |
@if $direction == 'up' { |
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 | |
$SECRET_KEY = ''; | |
$header = getallheaders(); | |
$hmac = hash_hmac('sha1', file_get_contents('php://input'), $SECRET_KEY); | |
if ( isset($header['X-Hub-Signature']) && $header['X-Hub-Signature'] === 'sha1='.$hmac ) { | |
$payload = json_decode( file_get_contents('php://input')); | |
shell_exec( 'cd /home4/pbshawa1/public_html/wordpress && git reset --hard HEAD && git pull' ); | |
} |
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: ACF Field to Excerpt | |
* Plugin URI: http://wordpress.stackexchange.com/q/70990/12615 | |
*/ | |
function acf_to_excerpt(){ | |
$post_type = 'post'; | |
$field = 'summary'; | |
NewerOlder