Skip to content

Instantly share code, notes, and snippets.

View raftaar1191's full-sized avatar
🏠
Working from home

Deepak Gupta raftaar1191

🏠
Working from home
View GitHub Profile
@raftaar1191
raftaar1191 / functions.php
Created January 27, 2020 08:14
Filter to Sort CPT via taxonomies in CPT DashBoard area
/**
* Add filter in the CPT
*/
function CPT_filter_by_taxonomies( $post_type, $which ) {
// Apply this only on a specific post type
if ( 'CPT' !== $post_type ) {
return;
}
@raftaar1191
raftaar1191 / my.sql
Created December 17, 2019 11:17
Delete all the shop_subscription, Licences and Orders and Users
DELETE FROM wp_postmeta where post_id IN (SELECT ID from wp_posts where post_type = 'shop_subscription' );
DELETE FROM wp_comments where comment_post_ID IN (SELECT ID from wp_posts where post_type = 'shop_subscription' );
DELETE from wp_posts where post_type = 'shop_subscription'
@raftaar1191
raftaar1191 / custom-woocommerce-weebhook.php
Last active December 12, 2019 08:08
Custom WooCommerce Webhook
<?php
/**
* Plugin Name: Custom WooCommerce Webhook
* Plugin URI: https://raftaar1191.com/
* Description: This plugin provided a demo of Custom WooCommerce Webhook
* Author: raftaar1191
* Author URI: https://profiles.wordpress.org/raftaar1191/
* Version: 1.0.0
*/
@raftaar1191
raftaar1191 / functions.php
Last active November 8, 2019 09:25
Change his/her text in other language in BuddyBoss platform activity when someone update his/her activity
/**
* This will translate the string
*/
function child_theme_slug_setup() {
load_child_theme_textdomain( 'buddyboss-theme-child', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'child_theme_slug_setup' );
@raftaar1191
raftaar1191 / Custom Steps
Created October 30, 2019 08:59
Migrate Database via WP Migrate DB - plugins
1 step-> Install and Activated the WP Migrate DB plugin to the sites where you want to export the CSV
2 Step-> Now in the Dashboard browse to Tools > Migrate DB Menu
3 Step->
Click on Export radio button and check the both the checkbox option inside it `Save as file to your computer` and `Compress file with gzip`
In the Find and replace section
In the Find Box enter the Live sites URL and in the Replace box enter the Local site URL
https://prnt.sc/pq1019
Login to a server
SSH USERNAME@SERVER DOMAIN NAME/SERVERIP ADDRESS
Example: ssh deepak@raftaar1191.com or ssh deepak@102.345.23.34.com
@raftaar1191
raftaar1191 / functions.php
Created October 23, 2019 11:14
Hide the Wp-admin bar for all the user other then admin
/**
* Hide the Wp-admin for all the user other then admin
*/
function buddyboss_child_wp_head_hide_admin_bar() {
if ( is_user_logged_in() ) {
global $current_user;
$roles = (array) $current_user->roles;
if ( ! in_array( 'administrator', $roles ) ) {
?>
<?php
/**
* Plugin Name: BuddyBoss Platform
* Plugin URI: https://buddyboss.com/
* Description: The BuddyBoss Platform adds community features to WordPress. Member Profiles, Activity Feeds, Direct Messaging, Notifications, and more!
* Author: BuddyBoss
* Author URI: https://buddyboss.com/
* Version: 1.1.9
* Text Domain: buddyboss
* Domain Path: /languages/
@raftaar1191
raftaar1191 / functions.php
Last active May 16, 2023 06:06
BuddyPress Print shortcode
function BP_theme_child_profile_link( $atts ) {
$text = isset( $atts['text'] ) ? $atts['text'] : 'Profile Link';
$profile_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() );
$profile_link = trailingslashit( $profile_link . 'change-avatar' );
return sprintf( '<a href="%s">%s</a>', $profile_link, $text );
}
add_shortcode( 'BP_profile_link', 'BP_theme_child_profile_link' );
add_filter( 'bp_core_render_message_content', 'do_shortcode' );
@raftaar1191
raftaar1191 / content-bbpress.php
Created October 15, 2019 09:17
Add Main Forum title in Sub Menu fourms
<?php
/**
* Template part for displaying posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package BuddyBoss_Theme
*/
?>