View addthis_layers_array.php
<?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
View addthis_share_array.php
<?php
add_filter( 'addthis_share_array', function ( $addthis_share ) {
$addthis_share['title'] = 'My custom title';
$addthis_share['url'] = 'http://example.com/my-custom-title';
return $addthis_share;
});
View acf_filter_choice.php
<?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 ) {
View sum_total_orders_revenue.php
<?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' ) )
View array_dechunk.php
function array_dechunk( $array ) {
return array_reduce( $array, function ( $carry, $item ) {
return array_merge( $carry, $item );
}, [] );
}
View jenkins_wpsvn_deploy.sh
# In your Jenkins job configuration, select "Add build step > Execute shell", and paste this script contents.
# Replace `______your-plugin-name______`, `______your-wp-username______` and `______your-wp-password______` as needed.
# main config
WP_ORG_USER="______your-wp-username______" # your WordPress.org username
WP_ORG_PASS="______your-wp-password______" # your WordPress.org password
PLUGINSLUG="______your-plugin-name______"
CURRENTDIR=`pwd`
MAINFILE="______your-plugin-name______.php" # this should be the name of your main php file in the wordpress plugin
View wp-ctrl-addthis-sidebar.php
<?php
/**
* Controls the display of the AddThis Sharing Sidebar style using the
* show/hide Addthis sharing radio buttons in admin post add/edit page.
*/
add_action( 'wp', 'ctrl_addthis_sidebar' );
function ctrl_addthis_sidebar() {
if ( get_post_meta( get_the_ID(), '_at_widget', true ) == 0 ) {
global $AddThis_addjs_sharing_button_plugin;
remove_action( 'wp_footer', array( $AddThis_addjs_sharing_button_plugin, 'output_script' ) );
View require-post-title.php
<?php
add_action( 'edit_form_advanced', 'force_post_title' );
function force_post_title( $post ) {
// List of post types that we want to require post titles for.
$post_types = array(
'post',
'report',
// 'event',
View spotify.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Refresh Miami ReactJS</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
View todo-react.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Refresh Miami ReactJS</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">