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 | |
| add_filter( 'gform_field_content', function ( $field_content, $field ) { | |
| if ( $field->type == 'email' ) { | |
| return str_replace( 'type=', "autocomplete='email' type=", $field_content ); | |
| } | |
| if ( $field->type == 'name' ) { | |
| return str_replace( 'type=', "autocomplete='name' type=", $field_content ); | |
| } | |
| return $field_content; |
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 | |
| //Uncomment the following line for converting one role to another | |
| //add_action( 'the_post', 'convert_subscribers_to_executives' ); | |
| function convert_subscribers_to_executives() { | |
| //Note: this only works by navigating to the page with ID 5883 on the site | |
| //to kick off the loop that updates all of the users. | |
| if (get_the_ID() === 5883) { | |
| //get all subscribers from this WP site | |
| $blogusers = get_users( 'blog_id=1&orderby=nicename&role=subscriber' ); |
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
| //gets the total number of WooCommerce orders from the WP database | |
| function get_number_of_orders() { | |
| global $wpdb; | |
| //get number of orders from database as array | |
| $number_of_orders_array_n = $wpdb->get_results( | |
| "SELECT COUNT(*) FROM wp_posts WHERE post_type = 'shop_order'", ARRAY_N); | |
| //convert number of orders array into a number |
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
| font-family: -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif; |
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 | |
| add_action( 'wp_enqueue_scripts', 'mytheme_scripts' ); | |
| /** | |
| * Enqueue Dashicons style for frontend use when enqueuing your theme's style sheet | |
| */ | |
| function mytheme_scripts() { | |
| wp_enqueue_style( 'mytheme-style', get_stylesheet_uri(), 'dashicons' ); | |
| } |
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
| array( | |
| 'name' => __( 'My Number Field', 'theme-domain' ), | |
| 'desc' => __( 'Numbers only', 'msft-newscenter' ), | |
| 'id' => $prefix . 'number', | |
| 'type' => 'text', | |
| 'attributes' => array( | |
| 'type' => 'number', | |
| 'pattern' => '\d*', | |
| ), | |
| ), |
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
| // Include gulp | |
| var gulp = require('gulp'); | |
| // Include Our Plugins | |
| var jshint = require('gulp-jshint'); | |
| var sass = require('gulp-sass'); | |
| var concat = require('gulp-concat'); | |
| var uglify = require('gulp-uglify'); | |
| var rename = require('gulp-rename'); | |
| var browserSync = require('browser-sync').create(); |
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
| //Cursor named "result" | |
| //if statement makes sure we actually got back some data from the db | |
| if (result.moveToFirst() != false) { | |
| //for each row (representing a row of db) | |
| while (result.moveToNext() != false) { | |
| //for each column, representing a value from the row | |
| for (int i = 0; i < result.getColumnCount(); i++) { | |
| Log.d("Name of db column: ", result.getColumnName(i)); | |
| String val = result.getString(i); | |
| Log.d("Value for column: ", val); |
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
| // Include gulp | |
| var gulp = require('gulp'); | |
| // Include Our Plugins | |
| var jshint = require('gulp-jshint'); | |
| var sass = require('gulp-sass'); | |
| var concat = require('gulp-concat'); | |
| var uglify = require('gulp-uglify'); | |
| var rename = require('gulp-rename'); |
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 mm_sanitize($unsanitized_input) { | |
| //calls a WordPress core function | |
| //verifies UTF-8 encoding, strips tags | |
| //removes whitespace/newlines & octets | |
| //reference: | |
| //https://codex.wordpress.org/Function_Reference/sanitize_text_field | |
| return sanitize_text_field($unsanitized_input); | |
| } |