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 / tickets.php
Last active August 5, 2024 13:19
Using WP Statuses for custom Post Types.
<?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 February 24, 2017 06:37
Anonymise Idea authors in WP Idea Stream
<?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(
@imath
imath / wp-idea-stream-custom.php
Created February 14, 2017 20:21
Allow editor to Manage/Moderate Ideas
<?php
/**
* What is the wp-idea-stream-custom.php file ?
* @see https://github.com/imath/wp-idea-stream/wiki/wp-idea-stream-custom.php
*/
function uana_map_to_editor( $caps, $cap, $user_id, $args ) {
/**
* Role > min cap.
* editor > edit_pages
@imath
imath / wp-idea-stream-custom.php
Created February 2, 2017 15:10
Add an extra filter nav to filter ideas by category or only get unrated ideas (Needs the WP Idea Stream WordPress plugin)
<?php
/**
* For more infos about how to use the wp-idea-stream-custom.php file
* @see https://github.com/imath/wp-idea-stream/wiki/wp-idea-stream-custom.php
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
@imath
imath / bp-custom.php
Created January 31, 2017 11:14
This is a reply to my contact form. Question was: how is it possible to include the file's owner display name in BuddyDrive loops.
<?php
/**
* @see https://codex.buddypress.org/themes/bp-custom-php/
* to learn more about the bp-custom.php file
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
* Edit each fetched Buddydrive to include the file owner display name.
@imath
imath / functions.php
Created January 16, 2017 09:13
Add a widget area above the WP Idea Stream archive page. The full child theme is available here: https://cldup.com/yk8pyyY1p1.zip
<?php
/**
* 1st step: Just register a new sidebar.
*/
function twentyseventeen_child_register_sidebar() {
register_sidebar( array(
'name' => __( 'Ideas', '2017-child' ),
'description' => __( 'Above the list of ideas', '2017-child' ),
'id' => 'ideas',
<?php
/**
* WP Idea Stream Custom
*
* If i'm located in WP_PLUGIN_DIR, WP Idea Stream will load me.
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
@imath
imath / wp-idea-stream-custom.php
Created December 6, 2016 17:59
Add a confirmation prompt to remove link in BuddyPress groups.
<?php
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
function georgio_idea_footer_actions( $footer = '' ) {
if ( ! bp_is_group() ) {
return $footer;
}
@imath
imath / wp-idea-stream-custom.php
Created December 2, 2016 14:47
Temporary fix for https://wordpress.org/support/topic/commenting-bug-under-buddypress-groups-multisite/ so that users can wait for WP Idea Stream 2.3.4...
<?php
/**
* Temporary fix for:
* https://wordpress.org/support/topic/commenting-bug-under-buddypress-groups-multisite/
*
* Will be part of WP Idea Stream 2.3.4
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
@imath
imath / functions.php
Created September 20, 2016 08:58
Put this in any random file inside wp-content/mu-plugins to fix all custom language packs for plugins. Make sure the corresponding custom language packs are in WP_LANG_DIR/pluginName/
<?php
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
function fix_all_custom_language_packs_load_textdomain_mofile( $mofile, $domain ) {
if ( WP_LANG_DIR . '/plugins' === dirname( $mofile ) ) {
$mo = basename( $mofile );
$alt = trailingslashit( WP_LANG_DIR ) . $domain . '/';