Skip to content

Instantly share code, notes, and snippets.

View alamgircsebd's full-sized avatar

Alamgir Hossain alamgircsebd

View GitHub Profile
@alamgircsebd
alamgircsebd / delete.php
Last active January 4, 2023 04:29
Scripts for Delete WooCommerce Products by User ID
<?php
$userID = 2;
$args = array( 'author' => $userID, 'post_type' => 'product', 'posts_per_page' => -1, 'post_status' => array( 'publish', 'pending', 'draft', 'future' ) );
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
wp_delete_post( get_the_ID(), true );
@alamgircsebd
alamgircsebd / sc_customer_logout.php
Last active December 22, 2022 11:52
Add this on your theme functions.php file then use this shortcode [sc_customer_logout]
<?php
// Add this on your theme functions.php file then use this shortcode [sc_customer_logout]
add_shortcode( 'sc_customer_logout', 'sc_customer_logout' );
/**
* Add a logout shortcode button
*/
function sc_customer_logout() {
ob_start();
if ( is_user_logged_in()) :
<script>
( function( $ ) {
fetch('https://backend.turinlabs.com/graphql', {
method: 'POST',
headers: {
'apiKey': 'turinpay_sk_test_c6c713d9-d4e6-4b7e-893a-005b5b2a5bd2',
},
body: JSON.stringify({
query: `
mutation CREATE_PAYMENT_INTENT_MUTATION($input: CreatePaymentIntentInput!) {
<?php
function custom_rewrite_basic() {
add_rewrite_endpoint( 'custom_slug', EP_PAGES );
add_rewrite_rule( 'custom_slug/([^/]+)/?$', 'index.php?custom_slug=$matches[1]', 'top' );
}
add_action( 'init', 'custom_rewrite_basic' );
function custom_register_query_var( $vars ) {
$vars[] = 'custom_slug';
( function ( $ ) {
const wcf_page_title_notification = {
vars: {
originalTitle: document.title,
interval: null,
},
On( notification, intervalSpeed ) {
const _this = this;
_this.vars.interval = setInterval(
function () {
@alamgircsebd
alamgircsebd / gist:d6b4cb0fd7612a8494f46c443e4a2c51
Created September 23, 2021 15:37
Remove delete option from Dokan vendor product listing
/**
* Remove delete option from dokan vendor product listing
* add this script on your theme functions.php file
*
* @param array $actions
*
* @return array $actions
*/
function remove_delete_option_dokan_product_row_actions( $actions ) {
unset( $actions['delete'] );
@alamgircsebd
alamgircsebd / gist:258fcc79ee75710eb729deb82c4a1d94
Created August 9, 2021 08:09
Dokan product description media buttons added
/**
* Dokan product description media buttons added
*
* @param array $args
*
* @return array $args
*/
function dokan_product_description_media_button_added( $args ) {
$args['media_buttons'] = true;
@alamgircsebd
alamgircsebd / gist:872ffb89891c49aa14afb84a65cfe4f5
Created June 21, 2021 09:41
Dokan setting get support option force always checked
/**
* Dokan setting get support option force always checked
*/
function dokan_settign_get_support_checkbox_force_checked() {
if ( is_user_logged_in() && function_exists( 'dokan_is_seller_dashboard' ) && dokan_is_seller_dashboard() ) {
?>
<script>
(function($) {
var Dokan_Settign_Get_Support_Checkbox_Customized = {
init: function() {
@alamgircsebd
alamgircsebd / gist:5b540ff972de76216184bf0652cc4978
Created June 4, 2021 06:10
Dokan product page downloadable and virtual force always checked
/**
* Dokan product page downloadable and virtual force always checked
*/
function dokan_product_page_downloadable_virtual_checkbox_force_checked() {
if ( is_user_logged_in() && function_exists( 'dokan_is_seller_dashboard' ) && dokan_is_seller_dashboard() ) {
?>
<script>
(function($) {
var Dokan_Product_Virtual_Download_Checkbox_Customized = {
init: function() {
@alamgircsebd
alamgircsebd / gist:cd9464c425228edfa525e46880465c43
Created May 30, 2021 16:17
Removed dokan shipping tab from single product page
/**
* Removed dokan shipping tab from single product page
*
* @param array $tabs
*/
function remove_dokan_registered_product_shipping_tab( $tabs ) {
unset( $tabs['shipping'] );
return $tabs;
}