Skip to content

Instantly share code, notes, and snippets.

Avatar
🔌
Contributing to #BuddyPress

imath imath

🔌
Contributing to #BuddyPress
View GitHub Profile
@imath
imath / bp-custom.php
Last active Apr 6, 2020
Outputs the content of the Activity WordPress page into the BP Activity directory.
View bp-custom.php
<?php
/**
* BP Custom function file.
*
* Add this file into /wp-content/plugins/ to customize BuddyPress.
*
* @see https://codex.buddypress.org/themes/bp-custom-php/
*/
// Exit if accessed directly.
@imath
imath / post-taxonomy-panel.js
Created Mar 1, 2020
Example of use of the filter to replace the PostTaxonomy panel of the WordPress Block Editor
View post-taxonomy-panel.js
const { createElement, Component } = wp.element;
const { compose } = wp.compose;
const { RadioControl } = wp.components;
const { withSelect, withDispatch } = wp.data;
const { addFilter } = wp.hooks;
const { apiFetch } = wp;
const { __ } = wp.i18n;
class RiskDomain extends Component {
constructor() {
@imath
imath / post_content.html
Created Feb 25, 2020
Exemple de bloc WordPress sauvegardé dans le champ `post_content` d'un type de publication
View post_content.html
<!-- wp:wpqba/block {"wpqbaAttributeOne":"Un","wpqbaAttributeTwo":1} -->
<div class="wp-block-wpqba-block">
<h2>Test inputs</h2>
<div class="row">
<div class="label">
<span>Test input One</span>
</div>
<div class="value">
<span>Un</span>
</div>
@imath
imath / mu-plugins-functions.php
Created Jan 12, 2020
Deactivate or move the trackback URI control
View mu-plugins-functions.php
<?php
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Ajouter ce code dans un fichier du répertoire /wp-content/mu-plugins
* de votre WordPress pour désactiver l'insertion du contrôle pour afficher
* l'URL de trackback de l'article affiché.
@imath
imath / members-loop.php
Last active Dec 22, 2019
Display profile field within BP Nouveau using the template hierarchy. Put the following into a /buddypress/members/ subfolder of your theme and replace `Name of your xProfile field` with the name of your profile field :)
View members-loop.php
<?php
/**
* BuddyPress - Members Loop
*
* @since 3.0.0
* @version 3.0.0
*/
bp_nouveau_before_loop(); ?>
@imath
imath / bp-custom.php
Created Sep 13, 2019
Activate "Activités de publication" for all new page items by default. (Requires https://github.com/imath/activites-de-publication/)
View bp-custom.php
<?php
/**
* For more information about how to use the bp-custom.php file
* @see https://codex.buddypress.org/themes/bp-custom-php/
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
@imath
imath / bp-example-block.php
Created Jul 31, 2019
BuddyPress example block: Put this two file into a `bp-example-block` folder before dropping it into `/wp-content/plugins/`
View bp-example-block.php
<?php
/**
* Plugin Name: BP Example Block
* Plugin URI: https://buddypress.org/
* Description: Example of BuddyPress block.
* Author: The BuddyPress Community
* Author URI: https://buddypress.org/
* Version: 1.0.0
* Text Domain: buddypress
* Domain Path: /languages/
@imath
imath / bp-custom.php
Created Jul 12, 2019
Registering REST Fields for the BP REST API
View bp-custom.php
<?php
// Registers a REST field for the Activity Endpoints.
function example_register_activity_rest_field() {
bp_rest_register_field(
'activity', // Id of the BuddyPress component the REST field is about
'example_field', // Used into the REST response/request
array(
'get_callback' => 'example_get_rest_field_callback', // The function to use to get the value of the REST Field
'update_callback' => 'example_update_rest_field_callback', // The function to use to update the value of the REST Field
@imath
imath / tickets.php
Last active Aug 18, 2020
Using WP Statuses for custom Post Types.
View tickets.php
<?php
/**
* Using WP Statuses for custom Post Types.
*
* @link http://github.com/imath/wp-statuses
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
@imath
imath / wp-idea-stream-custom.php
Created Feb 24, 2017
Anonymise Idea authors in WP Idea Stream
View wp-idea-stream-custom.php
<?php
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
* Référencer un Idea Meta !
*/
function uana_custom_register_metas() {
// A very simple way to add a custom field (for text field only)
wp_idea_stream_ideas_register_meta( 'anonymous', array(
You can’t perform that action at this time.