Skip to content

Instantly share code, notes, and snippets.

View mehul0810's full-sized avatar
👋
Hello Folks. Thanks for visiting my GitHub profile

Mehul Gohil mehul0810

👋
Hello Folks. Thanks for visiting my GitHub profile
View GitHub Profile
@mehul0810
mehul0810 / woo_add_product_tab_admin.php
Last active April 5, 2016 06:58
Woocommerce | Add Product Tab to Products Data Metabox under add new product
<?php
function add_my_custom_product_data_tab( $product_data_tabs ) {
$product_data_tabs['my-custom-tab'] = array(
'label' => __( 'My Custom Tab', 'my_text_domain' ),
'target' => 'my_custom_product_data',
);
return $product_data_tabs;
}
add_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' );
@mehul0810
mehul0810 / export-csv-with-php.php
Last active May 16, 2023 03:02
Easily Export Data to CSV with PHP: A Comprehensive Guide for Beginners & Developers https://mehulgohil.com/blog/export-data-to-csv-using-php/
<?php
/**
* CSV Export functionality using PHP.
*
* For development enquiries head over to https://mehulgohil.com/contact/
*
* @author Mehul Gohil
*/
// Start the output buffer.
@mehul0810
mehul0810 / FilterWordPressSearch.php
Created June 17, 2017 03:22
This script will filter default WordPress Search by the post type which you want to search for.
<?php
/**
* Filter WordPress Search for specific post types
*
* @param $query
*
* @return mixed
*/
function bloggerpro_only_post_search( $query ) {
if ( $query->is_search ) {
@mehul0810
mehul0810 / WordPressPingList.txt
Created July 9, 2017 11:27
WordPress PingList to boost crawling rate of newly created blog post
http://rpc.pingomatic.com
http://rpc.technorati.com/rpc/ping
http://rpc.twingly.com
http://blogsearch.google.com/ping/RPC2
http://api.feedster.com/ping
http://api.moreover.com/RPC2
http://api.moreover.com/ping
http://api.my.yahoo.com/RPC2
http://api.my.yahoo.com/rss/ping
http://bitacoras.net/ping
<?php
/**
* This function will help to create different excerpt length for different post types.
*
*/
function mg_variable_excerpt_length( $length ) {
// Declare $post global variable to detect current post type.
global $post;
// Check for the type of post type and based on which assign the excerpt length for each post type.
@mehul0810
mehul0810 / variable_read_more.php
Last active August 13, 2017 07:20
Different Read More Text for Different Post Types
<?php
/**
* This function will help to create different text for read more of different post types.
*
*/
function mg_variable_excerpt_read_more( $more ) {
// Declare $post global variable to detect current post type.
global $post;
// Check for the post type based on which assign the read more text for each post type.
<?php
/**
* Enable Dashicons for WordPress FrontEnd.
*/
function mg_enable_dashicons_frontend() {
// Enable Dashicons Stylesheet.
wp_enqueue_style( 'dashicons' );
}
add_action( 'wp_enqueue_scripts', 'mg_enable_dashicons_frontend' );
<?php
/**
* The Class.
*/
class Give_Sample_Meta_Box {
/**
* Hook into the appropriate actions when the class is constructed.
*/
public function __construct() {
@mehul0810
mehul0810 / Rename_Existing_Product_Data_Tabs.php
Created October 19, 2017 13:24
How to Rename Existing Product Data Tabs?
<?php
function mg_woo_rename_tabs( $tabs ) {
// Rename the Description Tab.
$tabs['description']['title'] = __( 'Details', 'your-textdomain-here' );
// Rename the Reviews Tab.
$tabs['reviews']['title'] = __( 'Ratings', 'your-textdomain-here' );
// Rename the Additional Information Tab.
$tabs['additional_information']['title'] = __( 'More Information', 'your-textdomain-here' );
@mehul0810
mehul0810 / Remove_Existing_Product_Data_Tabs.php
Created October 19, 2017 13:32
How to Remove Existing Product Data Tabs Programmatically in WooCommerce?
<?php
/**
* Remove Existing Product Data Tabs from Products Detail Page
*
* @param array $tabs List of Tabs displayed on Products Detail Page.
*
* @return array $tabs
*/
function mg_woo_remove_product_tabs( $tabs ) {