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 | |
| define('WP_CACHE', 1); // Added by WP Rocket | |
| /** | |
| * The base configuration for WordPress, modified to work in both server and | |
| * local development environments with WP Engine. | |
| * | |
| * The WP Engine configuration adheres to the well-known 12-Factor App principles | |
| * of "Store config in the environment" (https://12factor.net/config) and | |
| * "Dev/Prod Parity" (https://12factor.net/dev-prod-parity). This means you should | |
| * use the same files and test environments on laptops as well as servers, and |
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 | |
| $get_form_input = filter_input( INPUT_POST, $this->plugin_name , FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); | |
| $user_selected_video_taxonomies = isset( $get_form_input['video_taxonomies'] ) ? wp_unslash( $get_form_input['video_taxonomies'] ) : array(); | |
| $tax_query = array(); | |
| // create a dynamic tax_query if the user selected taxonomy terms in the search filters. | |
| foreach ( $user_selected_video_taxonomies as $taxonomy_slug => $taxonomy_terms ) { | |
| if ( ! empty( $user_selected_video_taxonomies[ $taxonomy_slug ] ) ) { | |
| // tax_query takes an array of arrays. |
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 | |
| /** | |
| * ACF parse and find all blocks with a given name | |
| * @return: block Array(), blocks Array() or false | |
| * @author: Bojan | |
| * v0.1 | |
| * @usage: find_blocks('acf/adtheme-accordion'); | |
| * @usage: find_blocks('acf/adtheme-accordion', $post_id); | |
| * TODO: refactor using modern recursive 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
| // this function will work cross-browser for loading scripts asynchronously | |
| function loadScript(src) { | |
| return new Promise(function(resolve, reject) { | |
| const s = document.createElement('script'); | |
| let r = false; | |
| s.type = 'text/javascript'; | |
| s.src = src; | |
| s.async = true; | |
| s.onerror = function(err) { | |
| reject(err, s); |
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
| <script type="text/javascript"> | |
| // let's make call to the global gwrf variable visible after enabling Gravity Forms | |
| window.gwrf; | |
| (function ($) { | |
| gwrf = function (args) { | |
| // prototype arguments, created when we instantiate it | |
| this.formId = args.formId; | |
| this.spinnerUrl = args.spinnerUrl; |
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
| /** | |
| * Filter out hard-coded width, height attributes on all images in WordPress. | |
| * https://gist.github.com/4557917 | |
| * | |
| * This version applies the function as a filter to the_content rather than send_to_editor. | |
| * Changes made by filtering send_to_editor will be lost if you update the image or associated post | |
| * and you will slowly lose your grip on sanity if you don't know to keep an eye out for it. | |
| * the_content applies to the content of a post after it is retrieved from the database and is "theme-safe". | |
| * (i.e., Your changes will not be stored permanently or impact the HTML output in other themes.) | |
| * |
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 | |
| // Returns if a country is in Europe | |
| // Pass in country name or code e.g. 'Spain' or 'ES'. | |
| function country_is_in_europe( $country ) { | |
| // Our list of countries | |
| $countries = array( | |
| 'AT' => 'Austria', | |
| 'BE' => 'Belgium', |
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
| deploy: | |
| script: | |
| - apt-get update -qq && apt-get install -y -qq lftp | |
| - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnv ./ public_html/ --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/" | |
| only: | |
| - master |
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 admin user | |
| add_action( 'init', function () { | |
| $username = 'admin'; | |
| $password = 'password'; | |
| $email_address = 'webmaster@mydomain.com'; | |
| if ( ! username_exists( $username ) ) { | |
| $user_id = wp_create_user( $username, $password, $email_address ); |
NewerOlder