This file contains hidden or 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 my_delete_function($post_id) { | |
| global $wpdb; | |
| // our custom code with $post_id | |
| } | |
| // outisde a class | |
| add_action( 'before_delete_post', 'my_delete_function' ); | |
| // inside a class | |
| add_action( 'before_delete_post', [ $this, 'my_delete_function' ] ); |
This file contains hidden or 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
| wp site list --allow-root > sites-list.txt | |
| siteslist=`tail -1 sites-list.txt | head -1` | |
| lastsiteurl=`echo $siteslist | egrep -o 'https?://[^ ]+'` | |
| lasturlclean=`echo ${lastsiteurl::-1}` | |
| lastid=`echo $lasturlclean|grep -Eo '[0-9]+$'` | |
| ((lastid++)) | |
| newslug="demo-${lastid}" | |
| newsiteurl=`wp site create --slug=$newslug --private --allow-root|awk '{print $5}'` | |
| username="demo${lastid}" | |
| useremail="demo${lastid}@demo.com" |
This file contains hidden or 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
| ls -1 | rev | cut -f 2- -d "." | rev | awk ' BEGIN { ORS = ""; print "["; } { print "\/\@"$0"\/\@"; } END { print "]"; }' | sed "s^\"^\\\\\"^g;s^\/\@\/\@^\", \"^g;s^\/\@^\"^g" > icons.txt |
This file contains hidden or 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
| const webpack = require("webpack"); | |
| //const path = require("path"); | |
| const MiniCssExtractPlugin = require("mini-css-extract-plugin"); | |
| module.exports = { | |
| transpileDependencies: ["vuetify"], | |
| outputDir: "../assets/", | |
| configureWebpack: { | |
| plugins: [ | |
| new MiniCssExtractPlugin({ |
This file contains hidden or 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 | |
| // This will error and break code | |
| $datetime = new DateTime( 1565301395 ); | |
| var_dump( $datetime ); | |
| // This will work | |
| $datetime = new DateTime(); | |
| $datetime->setTimestamp(1565301395); | |
| var_dump( $start_date ); |
This file contains hidden or 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
| #!/bin/bash | |
| function create_terms( ){ | |
| array=("$@") | |
| for tax; do true; done | |
| for term in "${array[@]}" | |
| do | |
| wp term create $tax "$term" --allow-root | |
| done |
This file contains hidden or 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
| #!/bin/bash | |
| for post in $(wp post list --field=ID --allow-root) | |
| do | |
| count=$(wp post term list $post 'category' --fields='name' --format="count" --allow-root) | |
| if [ "$count" -gt "1" ] | |
| then | |
| wp post term remove $post category 'uncategorized' --allow-root | |
| fi | |
| done |
This file contains hidden or 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
| wp scaffold child-theme twentynineteen-child --parent_theme=twentynineteen | |
| wp theme activate twentynineteen-child |
This file contains hidden or 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
| methods : { | |
| async setOtherBookings() { | |
| this.loadingOtherBookings = true; | |
| if (this.booking.other_bookings.length > 0) { | |
| for (let booking_post_id of this.booking.other_bookings) { | |
| await this.loadOtherBooking(booking_post_id).then(response => { | |
| this.addToSummary(response.data); | |
| }); | |
| } |
This file contains hidden or 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 mml_output_setting_row( $class, $name, $value , $option_key , $data_div, $text ){ ?> | |
| <p> <input type="checkbox" class="<?php echo $class ?>" name="powerpack-plugin-options[<?php echo $name ?>]" value="<?php echo $value ?>" <?php isset( $options['ecom-function'] ) ? checked($options['ecom-function'], 1) : '';?> data-div="<?php echo $data_div ?>"/><?php echo $text ?></p> | |
| <?php } |