Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
wpmudev-sls / smush-bulk-delete-bak-images.php
Last active May 2, 2020 20:11
[Smush] - Bulk Delete Bak Images
<?php
/**
* Plugin Name: [Smush] - Bulk Delete Bak Images
* Plugin URI: https://premium.wpmudev.org/
* Description: Deletes all .bak images
* Author: Panos Lyrakis @ WPMUDEV
* Author URI: https://premium.wpmudev.org/
* License: GPLv2 or later
*/
@KaineLabs
KaineLabs / yzc_add_profile_completeness_optinal_widget.php
Last active October 20, 2020 02:01
Add Optional Fields Widget
<?php
/**
* Add Optional Fields Widget.
*/
function yzc_add_profile_completeness_optinal_widget() {
if ( ! bp_is_my_profile() && ! current_user_can( 'administrator' ) ) {
return;
}
@KaineLabs
KaineLabs / yzc_add_new_activity_subtab.php
Last active September 15, 2022 15:22
Add Activity Comment Subtab
<?php
/**
* Add Activity Comment Subtab.
*/
function yzc_add_new_activity_subtab() {
global $bp;
bp_core_new_subnav_item( array(
'name' => __( 'Comments', 'youzer' ),
'slug' => 'comments',
@KaineLabs
KaineLabs / YZC_Activity_Custom_Post_Type.php
Last active September 25, 2024 16:07
Add Activity Custom Post Type.
<?php
/**
* Add Activity Custom Post Type.
*/
class YZC_Activity_Custom_Post_Type {
public $post_title;
public $post_type;
public $post_action;
public $enable_upload_attachments;
@KaineLabs
KaineLabs / yzc_exclude_users_by_role.php
Created April 23, 2019 20:48
Exclude Users from BuddyPress Members List by WordPress role.
<?php
/**
* Exclude Users from BuddyPress Members List by WordPress role.
*
* @param array $args args.
*
* @return array
*/
function yzc_exclude_users_by_role( $args ) {
// do not exclude in admin.
@cabrerahector
cabrerahector / wordpress-sort-posts-by-views.md
Last active April 15, 2023 17:57
[WordPress Popular Posts] Adding Views column to the Posts Manage page

Adding Views column to the Posts Manage page

This Gist shows how to add a sortable Views column to the post/page/custom-post-type edit screen.

Out of the box, the script will display the Views column on both the Posts and Pages screens. You can change that by editing the $post_types_with_views_column array at the beginning of the script.

How do I add this to my site?

  1. Using the text editor of your preference, create a file called wpp-sortable-columns.php and add the contents of this script to it.
  2. Place the wpp-sortable-columns.php file in wp-content\plugins.
@KaineLabs
KaineLabs / yzc_add_new_post_type_for_post_author_widget.php
Created March 16, 2019 18:48
Post Author Widget - Add new post types support
<?php
/**
* Post Author Widget - Add new post types support
*/
function yzc_add_new_post_type_for_post_author_widget( $types ) {
$types[] = 'gd_business';
return $types;
}
@KaineLabs
KaineLabs / yzc_add_md_online_tab.php
Last active October 20, 2020 02:01
Add Member Directory Online Tab
<?php
/**
* Add Member Directory Online Tab .
*/
function yzc_add_md_online_tab() {
$online_count= yzc_get_online_users_total();
?>
<style type="text/css">
@nvourva
nvourva / ci-star-rating.php
Created February 8, 2019 17:22
Ratings Plugin
<?php
/*
Plugin Name: CI Comment Rating
Description: Adds a star rating system to WordPress comments
Version: 1.0.0
Author: The CSSIgniter Team
Author URI: https://cssigniter.com/
*/
//Enqueue the plugin's styles.
@mstockton15
mstockton15 / functions.php
Created January 18, 2019 21:10
Add Paypal surcharge/handling fee to Woocommerce cart / checkout
//Add Paypal 2.9%+0.50 surcharge to Woocommerce cart / checkout
function df_add_handling_fee( $cart_object ) {
global $woocommerce;
$spfee = 0.00; // initialize special fee
$spfeeperprod = 0.50; //special fee per product
$percentage = 0.029; //percentage
//Getting Cart Contents.
$cart = $woocommerce->cart->get_cart();
//Calculating Quantity