Skip to content

Instantly share code, notes, and snippets.

View imath's full-sized avatar
:octocat:
building the Retraceur PHP software!

imath imath

:octocat:
building the Retraceur PHP software!
View GitHub Profile
@imath
imath / manifest.json
Created July 29, 2026 13:12
Bout de code Retraceur's manifest.json file.
{
"$schema": "https://raw.githubusercontent.com/retraceur/ressources/refs/heads/main/schemas/retraceur-manifest.json",
"name": "imath/bout-de-code",
"type": "block",
"requires": {
"retraceur": "3.2.0",
"php": "7.4",
"dependencies": []
},
"author": {
@imath
imath / bout-de-code.php
Last active July 29, 2026 10:00
Bout de code Plugin header tags. Used to illustrate the Retraceur specific header tags (Plugin Type, Requires Retraceur, Up to Retraceur, GitHub Plugin URI)
<?php
/**
* A Retraceur Block to embed Gists in posts.
*
* @package Bout de code
* @author imath
* @license MIT
* @link https://imathi.eu
*
* @retraceur-block
@imath
imath / wp-content-mu-plugins-index.php
Created August 13, 2025 18:08
Filter hook to enable the Retraceur Cœur 1 click upgrade during 2.0.0 betatests.
<?php
/**
* Filter hook to enable the Retraceur Cœur 1 click upgrade during 2.0.0 betatests.
*
* You can use a `/wp-content/mu-plugins/index.php` file to always run this code into your Retraceur instance.
*/
add_filter( 'retraceur_betatest_direct_updates', '__return_true' );
@imath
imath / mu-plugins-functions.php
Created July 17, 2025 10:18
Retraceur filters & constants to use to bring back some default WP behaviours.
<?php
/**
* Custom functions.
*
* You can use a `/mu-plugins/functions.php` file to always run this code into your Retraceur instance.
*/
// Bring back WP regular registration workflow.
add_filter( 'retraceur_create_account_on_signup', '__return_true' );
@imath
imath / bp-custom.php
Created December 23, 2023 14:24
Disable BuddyPress Signups feature.
<?php
function disable_bp_signups() {
add_filter( 'bp_get_signup_allowed', '__return_false' );
remove_filter( 'register_url', 'bp_get_signup_page' );
remove_action( 'bp_init', 'bp_core_wpsignup_redirect' );
remove_filter( 'wp_signup_location', 'bp_blogs_creation_location' );
remove_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1 );
}
add_action( 'bp_include', 'disable_bp_signups' );
@imath
imath / bp-custom.php
Last active August 26, 2023 12:43
Personnalisation du répertoire des membres en fonction du type de membre de l'utilisateur connecté.
<?php
/**
* Créer deux nouveaux types de membre par exemple `gentlemen` et `ladies`.
* Se reporter à cette documentation: https://bpdevel.wordpress.com/2020/09/21/bp-types-admin-ui/
*
* Affecter ces types de membre aux utilisateurs
* Utiliser le code ci-dessous pour personnaliser le répertoire des membres en fonction du type
* de membre de l'utilisateur connecté.
*
* Se reporter à cette documentation pour la mise en place du fichier `bp-custom.php`:
@imath
imath / bp-custom.php
Last active May 30, 2023 19:53
Use an alternative to `bp_core_get_user_displayname()` to get the user's display name without HTML tags when sending a friendship request.
<?php
/**
* Custom function file.
*
* Put a file called `bp-custom.php` into your /wp-content/plugins folder.
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
@imath
imath / bp-custom.php
Created April 2, 2023 06:13
Filter to override the BP Attachments private directory
<?php
/**
* BP Attachments overrides.
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@imath
imath / functions.php
Created January 29, 2023 21:50
Workaround to make sure query pagination labels are translated when a block pattern is used to display the `core/query-pagination-previous` && `core/query-pagination-next` WordPress blocks
<?php
/**
* Workaround to make sure query pagination labels are translated.
*
* This function hooks `render_block_context` to transport the `core/query-pagination` block
* context inside the 'ensemble/pagination' pattern so that the `core/query-pagination-previous`
* & the `core/query-pagination-next` blocks can use it.
*
* @since 1.0.0
*
@imath
imath / single.html
Created January 29, 2023 19:36
WordPress template part to use to have previous and next post displayed into the pagination of the single template
<!-- wp:group {"tagName":"nav","className":"single-footer-pagination","layout":{"type":"flex","justifyContent":"space-between"}} -->
<nav class="wp-block-group single-footer-pagination">
<!-- wp:post-navigation-link {"type":"previous","showTitle":true} /-->
<!-- wp:post-navigation-link {"showTitle":true} /-->
</nav>
<!-- /wp:group -->