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_tax_parent_dropdown() { | |
$screen = get_current_screen(); | |
if ( 'region' == $screen->taxonomy ) { | |
if ( 'edit-tags' == $screen->base ) { | |
$parent = "$('label[for=parent]').parent()"; | |
} elseif ( 'term' == $screen->base ) { | |
$parent = "$('label[for=parent]').parent().parent()"; |
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 | |
add_filter( 'facetwp_query_args', function( $query_args, $class ) { | |
$query_args['post__not_in'] = [ 239 ]; | |
return $query_args; | |
}, 10, 2 ); |
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 | |
// ... | |
/** | |
* Tweak Archive pages queries. | |
* @param object $query | |
* @return object | |
*/ | |
function tweak_archives( $query ) { |
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
# Put parameters here that don't need to change on each machine where the app is deployed | |
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration | |
parameters: | |
locale: 'en' | |
# My application specific parameters. | |
app.gpu_qty: # The number of GPU cards each mining rig has. | |
rukia: 12 | |
zangetsu: 4 | |
app.gpu_share: 3 # How many GPU cards the two rig shares to divide profits. |
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 trash_empty_confirmation() { ?> | |
<script type="text/javascript"> | |
(function($) { | |
$('[id=delete_all]').click(function(e){ | |
return confirm( "Are you sure you want to permanently erase all content items in the Trash ?" ); | |
}); | |
})( jQuery ); | |
</script> |
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 | |
/** | |
* Output an AddThis floating share sidebar to the left with selected services. | |
* | |
* Notice 'desktop' and 'mobile' parameters, they take a Boolean data type as value, meaning it can be used to | |
* allow a more dynamic control and display of the sharing sidebar. | |
* | |
* More options to play with can be found here in the docs: https://www.addthis.com/academy/smart-layers-api/ | |
* Just notice to convert the JSON format in the examples to PHP's array() format |
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 | |
/** | |
* Removes custom style selector for non Administrator user roles. | |
* Uses acf/load_field filter https://www.advancedcustomfields.com/resources/acf-load_field/ | |
* | |
* @param array $field | |
* @return array | |
*/ | |
function acf_filter_radio_choices( $field ) { |
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 | |
// Sum all values from order_total column in completed orders, and return. | |
$qb = $em->createQueryBuilder(); | |
$qb = $qb | |
->select( 'SUM(e.orderTotal) as totalRevenue' ) | |
->from( '[Vendor]\[Package]\Entity\Orders', 'e' ) | |
->where( $qb->expr()->andX( | |
$qb->expr()->eq( 'e.orderStatus', ':status' ), | |
// $qb->expr()->in( 'e.state', array( 'queued', 'confirmed' ) ) |