Skip to content

Instantly share code, notes, and snippets.

@fovoc
fovoc / hbapicheck.php
Created June 23, 2018 09:20 — forked from JRMorris77/hbapicheck.php
Hummingbird API Quick Diagnostics
<?php
/**
* Script Name: Hummingbird API Quick Diagnostics
* Script URI: https://premium.wpmudev.org/
* Description: Misc diagnostic tools used by WPMU DEV SLS Tech Support
* Author: James Morris @ WPMU DEV
* Version: 0.1
* Author URI: https://premium.wpmudev.org/
*
*/
@fovoc
fovoc / create-admin-user.php
Last active October 20, 2017 14:12 — forked from wpscholar/create-admin-user.php
Create a new admin user in WordPress via code. Drop this file in the mu-plugins directory and update the variables, then load a page in WordPress to create the user. Remove the file when done.
<?php
add_action( 'init', function () {
$username = 'admin';
$password = 'password';
$email_address = 'webmaster@mydomain.com';
if ( ! username_exists( $username ) ) {
$user_id = wp_create_user( $username, $password, $email_address );
@fovoc
fovoc / index.html
Last active May 24, 2017 11:49 — forked from anonymous/double-line-subtitles.markdown
Double Line Subtitles
<article>
<h1>Main Title</h1>
<p class="subtitle fancy"><span>A fancy subtitle</span></p>
</article>
@fovoc
fovoc / 1-instructions.txt
Created October 21, 2016 14:03 — forked from bappi-d-great/1-instructions.txt
Add custom field in M2 registration form (Basic) WPMU Membership2
### We are adding telephone number as custom field
1. Go to /wp-content/plugins/membership/app/view/templates/ and copy all 4 files.
2. Go to /wp-content/themes/YOUR_CURRENT_THEME/ and create a new folder called membership2, then paste all 4 files inside the new created membership2 folder
3. Open membership_registration_form.php and put the following: membership_registration_form.php
4. Now open the membership_account.php file and put the following: membership_account.php
5. Finally need to add some code: mu-plugin.php
## You can add those codes in your functions.php in the theme,
## if you think your theme won’t be changed. Otherwise mu-plugins is the best solution.
@fovoc
fovoc / code.php
Created September 25, 2016 07:28 — forked from bappi-d-great/code.php
WPMU Membership assign membership based on role on registration
<?php
add_action( 'user_register', 'assign_membership_on_register', 10, 1 );
function assign_membership_on_register( $user_id ) {
$membership = array(
// 'role' => 'membership ID'
'abc' => 123,
'xyz' => 456
);
@fovoc
fovoc / code.php
Created September 22, 2016 07:35 — forked from bappi-d-great/code.php
WPMU Membership 2: Adding more column in billing table and sorting example
<?php
/**
* Example: Member first name and last name and sorting ASC and DESC
*/
add_filter( 'ms_helper_listtable_billing_get_columns', function( $columns, $currency ) {
$columns['first_name'] = 'First Name';
$columns['last_name'] = 'Last Name';
@fovoc
fovoc / code.php
Created September 22, 2016 07:35 — forked from bappi-d-great/code.php
WPMU Membership 2: Adding more column in member table
<?php
/**
* Example: User ID
*/
add_filter( 'ms_helper_listtable_member_get_columns', function( $columns ) {
$columns['user_id'] = 'User ID';
return $columns;
@fovoc
fovoc / exclude_original.php
Created September 14, 2016 13:01 — forked from UmeshSingla/exclude_original.php
Skip a Original size image from Smushing
add_filter('wp_smush_media_image', 'smush_skip_original_image', '', 2 );
function smush_skip_original_image( $skip, $image_size ) {
if( 'full' == $image_size ) {
return false;
}
return $skip;
}
@fovoc
fovoc / custom-notification.php
Last active December 7, 2020 03:13 — forked from modemlooper/custom-notification.php
BuddyPress add custom notification
<?php
// this is to add a fake component to BuddyPress. A registered component is needed to add notifications
function custom_filter_notifications_get_registered_components( $component_names = array() ) {
// Force $component_names to be an array
if ( ! is_array( $component_names ) ) {
$component_names = array();
}
// Add 'custom' component to registered components array
@fovoc
fovoc / code.php
Created August 5, 2016 16:54 — forked from bappi-d-great/code.php
Disable related videos in CoursePress youtube featured video
<?php
add_filter( 'oembed_result', function( $embed, $url, $args ) {
$url_string = parse_url( $url, PHP_URL_QUERY );
parse_str( $url_string, $id );
if( isset( $id['v'] ) )
{
return str_replace( '?feature=oembed', '?feature=oembed&rel=0', $embed );
}