- Entity - a thing to store in the database
- Repository - handles the entities
- Service - A tool or set of tools (like a Mailer or an API Library)
- Route - Links a URL to code
- Controller - The above code resides herein; routes that belong to eachother like lists for entities and CRUD for those entities are bundled in their own controller.
- View - How is the data presented to the user. This can be ANYTHING! HTML, XML, JSON, a File Download etc.
This file contains 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 | |
// supports Yoast SEO and Yoast SEO Premium | |
add_filter('wpseo_sitemap_entry', 'wpseo_sitemap_entry', 10, 3); | |
// Supports SEO by Rank Math | |
add_filter('rank_math/sitemap/entry', 'wpseo_sitemap_entry', 10, 3); | |
function wpseo_sitemap_entry ( $url, $type, $object ) { | |
global $sitepress; |
This file contains 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 | |
/** | |
* Translate post-type-archive-slug when different from post-type-slug. | |
* | |
* You can have your archive slug set to, for example /books and the singles on /book/title by setting | |
* $args['rewrite'] => [ 'slug' => 'book', ... ]; | |
* $args['has_archive'] => 'books'; | |
* when registering your post_type | |
* |
This file contains 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 | |
/** | |
* Hook in the 'errors' hook as this is just in time and allows us to return an error in case of conflict. | |
* | |
* @package rmpel/WordPress | |
* @subpackage rmpel/WordPress/AllowUsernameChange | |
*/ | |
add_action( | |
'user_profile_update_errors', |
This file contains 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 | |
/** | |
* Notes on the following section | |
* | |
* Correct set-up is: | |
* | |
* Set your page-for-posts to a certain WordPress Posts, for example /nl/nieuws/ | |
* Set your permalink structure to the same; /nieuws/%postname%/ | |
* |
This file contains 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 | |
// redirect to language if no language | |
add_action( 'after_setup_theme', function () { | |
if ( is_admin() ) { | |
// we are on admin; do nothing | |
return; | |
} | |
if ( $GLOBALS['pagenow'] === 'wp-login.php' ) { |
This file contains 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
#!/usr/bin/env bash | |
######### | |
## Configration: | |
## Set your primary and secondary development paths. | |
## YOU CANNOT HAVE SPACES IN THE PRIMARY PATH - If you have, then most tooling here will fail because of limitations in macOS Terminal. | |
## AND NO - This tool is not built to use a different terminal. | |
## | |
PRIMARY_LOCATION=~/Development | |
SECONDARY_LOCATION=/Volumes/Macintosh\ SD/Development |
This file contains 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 CODE MAKES ONE CRITICAL ASSUMPTION! | |
* You are actually using GADWP in TagManager mode. | |
* | |
* There is no check that TagManager is actively in use, if you disable TagManager, | |
* change the word 'init' to '_init' :) | |
*/ |
This file contains 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 | |
/** | |
* WHY? Because invalid HTML will break a page, will break visible form feedback. | |
* Still, WHY? Well, you are right, CF7 should do this all on their own. | |
*/ | |
add_action( 'wpcf7_save_contact_form', function(WPCF7_ContactForm $contact_form) { | |
// this is an action, contact_form not given as pointer, so get the pointer from CF7; | |
$cf = WPCF7_ContactForm::get_current(); |
This file contains 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 | |
/** | |
* Attention all WordPress developers. | |
* NEVER EVER EVER DO THIS: | |
wp_deregister_script('jquery'); | |
* AND I DO MEAN NEVER!!!!! | |
* Any plugin that has dependency on jQuery registered like | |
wp_register_script( 'a-script', .., .., deps: [ 'jquery ' ], ..); | |
* will now BREAK!!!! |