Ceci est une ancienne révision du document !
Table des matières
Wordpress
Documentation
Pour les développeurs
-
- Wordpress hooks
- liste des hooks sur Codex WP
- Ajax
- Form
- Settings
- wp_dropdown_categories: HTML dropdown list of categories (options: show_option_none, hierarchical, …)
Frameworks
- Sage The best WordPress starter theme with a modern front-end development workflow.
Frameworks
http://wordpress.org/extend/plugins/options-framework/ - The Options Framework Plugin makes it easy to include an options panel in any WordPress theme. It was built so developers can concentrate on making the actual theme rather than spending time creating an options panel from scratch.
Pods Framework - Pods is a framework for WordPress that allows you to create, extend, manage, and deploy customized content types and fields.
NHP-Theme-Options-Framework - Simple, easy to use, very extendable Options framework for WP themes.
Redux-Framework a fork of NHP-Theme-Options-Framework.
Sécuriser Wordpress
Wordfence
Two-factor (2FA)
- Two-factor plugin: 2FA with TOTP or Email
- enable 2FA for all: https://github.com/WordPress/two-factor/issues/307#issuecomment-624843209
Stream
Pour conserver les traces (QQQ) de toutes les actions dans Wordpress.
Admin Url
Changer l'url pour se connecter et de l'admin
-
- a light plugin that lets you easily and safely change wp-login.php. It doesn’t literally rename or change files in core, nor does it add rewrite rules. It simply intercepts page requests and works on any WordPress website. The wp-admin directory and wp-login.php page become inaccessible, so you should bookmark or remember the url. Deactivating this plugin brings your site back exactly to the state it was before.
-
- URL d’inscription et de mot de passe oublié: Il vous faut donner l’url. exemple : /login?action=register ou /login?action=lostpassword. Mais il n’y pas de redirection via le plugin, de l’url par défaut de WordPress (/wp-login.php?action=register ou /wp-login.php?action=lostpassword) sinon tout le monde pourrait connaître l’url d’administration de votre site.
Tricks & Tips
WP Query
Categories et tags
Dans une catégorie et dans d'autres:
$q = new \WP_Query([ 'cat'=> $cat->term_id, 'category__in'=> $another_categories_term_id, ...
Customize Admin
WP-Cron
# Use system crontab # */5 * * * * /usr/bin/wget -q -O - --delete-after https://xxxx.xx/wp-cron.php?doing_wp_cron define('DISABLE_WP_CRON', true);
Flash message & co
Côté back
- Afficher des notices (error or success) après une redirection: Displaying Errors from the save_post Hook in WordPress
Côté front
Emoji
Si on ne veut pas des émojis il faut supprimer les actions wordpress associés :
// Stop Loading wp-emoji-release.min.js and CSS file remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); remove_action( 'wp_print_styles', 'print_emoji_styles' );
Q & A
- http://themecheck.info Vérifier la qualité des thèmes.
Nginx configuration
Pour faire tourner Wordpress avec Nginx.
Cache
Wordpress gère nativement un cache (WordPress object cache) pour toutes ses données (transients, options, meta, posts, users …)
Avec APCu
- WordPress APCu Object Cache Backend by Scott Cariss (l3rady) (a fork from Mark Jaquith's APC Object Cache Backend)
- Ne pas oublier de définir une clé unique pour le site quand mutualisation de php avec
define('WP_APCU_KEY_SALT','<unique key>');
- Un outil de visualisation de l'état d'APCu est fourni dans sa distribution, que l'on peut retrouver ici krakjoe/apcu ; prendre le fichier apc.php dans la release correspondante à celle installée
Avec Memcached
- WordPress + Memcached One of the most bizarre critiques of WordPress that I often hear is “it doesn’t come with caching” – which makes no sense because Cache is one of the best features of WordPress out of the box
Autre trucs:
- NGinx plugins: https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/ (en bas de page)
Varnish
WordPress with Varnish
- Implementing WordPress with Varnish (Varnish documentation)
- Varnish HTTP Purge purge sends a PURGE request to the URL of a page or post every time it it modified.
- WPBase Cache was developed to optimize the WordPress deployment on varnish + nginx + php-fpm + php-apc server stack using three type of caches full page cache, db cache and opcode cache.
Update files without FTP
In wp-config.php
:
define('FS_METHOD','direct');
Load WordPress Posts With AJAX
- Article & Plugin by Michael Martin: Load Next WordPress Posts With AJAX
- Article by Emanuele Feronato: Loading WordPress posts with Ajax and jQuery, using the standard Kubrick theme without any plugin installed.
Maintenir un plugin sur Github ou GitLab
Bug avec MySql et Inner Join
Background & Async
Job, Runner …
-
- Async job
- but use http ajax so it's depends to request time limit
-
- Listening a MQ (RabbitMQ or Gearman)
Qlqs plugins
- Developpement
- query-monitor https://wordpress.org/plugins/query-monitor/
-
- Gestion de contenu
- Enhanced Media Library par wpUXsolutions
- Représentation et gestion du temps
- WPIT Gantt qui utilise Gantti
- WP SIMILE Timeline qui utilise SIMILE Timeline
- Carto
- Gestion d'accès (droits et autres rôles)
WP App Studio's plugins (free & not free).
Qlqs thèmes
- Qlqs thèmes sur artefacts.coop
Divi
Migrer un site:
- Exporter les réglages DIVI (dossier et-cache est pas bon)
Zerif-lite
- Search results for Zerif on docs.themeisle.com