Skip to content

Instantly share code, notes, and snippets.

View imuhammadshoaib's full-sized avatar
🎯
Focusing

Muhammad Shoaib imuhammadshoaib

🎯
Focusing
View GitHub Profile
@imuhammadshoaib
imuhammadshoaib / wc-reorder-tabs.php
Created August 17, 2020 15:50 — forked from woogists/wc-reorder-tabs.php
[Frontend Snippets][Editing product data tabs] Reordering product data tabs
/**
* Reorder product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {
$tabs['reviews']['priority'] = 5; // Reviews first
$tabs['description']['priority'] = 10; // Description second
$tabs['additional_information']['priority'] = 15; // Additional information third
@imuhammadshoaib
imuhammadshoaib / wc-rename-tabs.php
Created August 17, 2020 15:50 — forked from woogists/wc-rename-tabs.php
[Frontend Snippets][Editing product data tabs] Renaming product data tabs
/**
* Rename product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {
$tabs['description']['title'] = __( 'More Information' ); // Rename the description tab
$tabs['reviews']['title'] = __( 'Ratings' ); // Rename the reviews tab
$tabs['additional_information']['title'] = __( 'Product Data' ); // Rename the additional information tab
@imuhammadshoaib
imuhammadshoaib / wc-remove-tabs.php
Created August 17, 2020 15:49 — forked from woogists/wc-remove-tabs.php
[Frontend Snippets][Editing product data tabs] Remove product data tabs
/**
* Remove product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
unset( $tabs['additional_information'] ); // Remove the additional information tab
<?php
/**
* Plugin Name: WooCommerce Filter Orders By Custom Field
* Plugin URI: https://gist.github.com/imuhammadshoaib/48fccfde3a11816f80151ec94bf2c08e
* Description: Adds a filter to the Edit Orders admin page to show orders by the custom field - billing area.
* Version: 1.0.1
* Author: Muhammad Shoaib
* Author URI: https://github.com/imuhammadshoaib/
* Text Domain: ww-filter-orders
*/
@imuhammadshoaib
imuhammadshoaib / function.php
Created July 23, 2020 14:26
Print function with log WP
public function debug_log_content($msg,$filename) {
try {
$uploads = wp_upload_dir( null, false );
$logs_dir = $uploads['basedir'] . '/mnp-logs';
if ( ! is_dir( $logs_dir ) ) {
mkdir( $logs_dir, 0755, true );
}
@imuhammadshoaib
imuhammadshoaib / function.php
Created July 20, 2020 15:18
Wordpress Cron job with custom inerval
function myprefix_custom_cron_schedule( $schedules ) {
$schedules['every_six_hours'] = array(
'interval' => 21600, // Every 6 hours
'display' => __( 'Every 6 hours' ),
);
return $schedules;
}
add_filter( 'cron_schedules', 'myprefix_custom_cron_schedule' );
//Schedule an action if it's not already scheduled
@imuhammadshoaib
imuhammadshoaib / style.css
Created June 12, 2020 15:54
Bootstrap 4 Vertical Nav
body {
padding-top: 55px;
}
/* mobile navbar sidebar under lg breakpoint */
@media (max-width: 992px) {
.navbar-collapse.collapsing .navbar-nav {
display: block;
position: fixed;
@supports (-ms-ime-align: auto) {
.selector {
color: red;
}
}
$(":input:not(:hidden)").each(function (i) {
$(this).attr('tabindex', i + 1);
});
$(":input:not(:hidden)").each(function (i) {
$(this).attr('tabindex', i + 1);
});