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
| /* | |
| [[changeValue? &parent=`` &field=`` &value=`` ]] | |
| */ | |
| foreach ($modx->getIterator('modResource', array('parent' =>$parent)) as $res) { | |
| $res->set($field,$value); | |
| $res->save(); | |
| echo ($action.'=>'.$value.'! <br/>'); |
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 | |
| /* | |
| Name: | |
| findReplaceTV | |
| Description : | |
| This snippet is useful if you want to batch replace a string in multiple resources at once. |
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 | |
| ////////////////////// | |
| // SECURE WP_ADMIN // | |
| ////////////////////// | |
| // ---- 1. edit wp-config.php | |
| /* tells wordpress what the new directory is, and updates the cookie path. | |
| define( 'WP_ADMIN_DIR', 'manager' ); | |
| define( 'ADMIN_COOKIE_PATH', '/' ); | |
| */ |
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
| server { | |
| root /path/to/site; | |
| index index.php; | |
| server_name somedomain.co.uk www.somedomain.co.uk; | |
| set $cache_uri $request_uri; | |
| # POST requests and urls with a query string should always go to PHP | |
| if ($request_method = POST) { | |
| set $cache_uri 'null cache'; |
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
| # switch ArticlesContainer -> CollectionContainer | |
| # the res. ID I want to migrate is 11 | |
| UPDATE `modx_site_content` SET `class_key` = replace(class_key, 'ArticlesContainer', 'CollectionContainer') WHERE id=11; | |
| # switch class_key to go back to default document view for children | |
| UPDATE `modx_site_content` SET `class_key` = replace(class_key, 'Article', 'modDocument') WHERE parent=11; | |
| # Change template 49 -> 57 |
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 show_current_template($wp_admin_bar) | |
| { | |
| global $template; | |
| $args = array( | |
| 'id' => 'current_template', | |
| 'title' => basename($template), | |
| 'meta' => array('title' => $template), | |
| ); | |
| $wp_admin_bar->add_node($args); |
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 true if we are working on a development server, determined by server's | |
| * hostname. Will generate an error if run on an unknown host. | |
| */ | |
| function isdev() | |
| { | |
| $isdev = null; | |
| // don't run function body more than once |
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 | |
| /** | |
| * Ajoute un tab/endpoints dans la partie mon compte | |
| * https://nicola.blog/2017/08/01/add-enquiry-form-my-account-woocommerce-contact-form-7/ | |
| * | |
| */ | |
| class WC_Custom_My_Account_Tabs extends WC_Query { | |
| /** | |
| * Adds main filters and actions and inits the endpoints. |
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 | |
| //////////////////////////////////////////// | |
| // Manage WooCommerce styles and scripts. // | |
| //////////////////////////////////////////// | |
| function woocommerce_script_cleaner() { | |
| // Remove the generator tag | |
| remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); | |
| // remove definitly, no need of this one | |
| /////////////////////////////////////////////////// |
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 is a muplugin | |
| * | |
| * Indexation des champs ACF "Auteurs" (relationnel) et "Année" (post_date) dans Elasticsearch index | |
| * pour WPSOLR | |
| */ | |
| use wpsolr\core\classes\WPSOLR_Events; |