Skip to content

Instantly share code, notes, and snippets.

View imran-khan1's full-sized avatar

Imran Khan imran-khan1

  • WordPress Developer
  • Pakistan
View GitHub Profile
<?php
get_header(); ?>
<div id="main-content" class="main-content">
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<table>
<?php
// Start the Loop.
<?php
function wcik_add_page_template ($templates) {
$templates['archive-manufacturer.php'] = 'Manufacturer';
return $templates;
}
add_filter ('theme_page_templates', 'wcik_add_page_template');
function wcik_archive_page_template ($template) {
<?php
/*
Plugin Name: Woo IK Manufacturer
Plugin URI: http://codeinform.com/custom-woocommerce-plugin-development/
Description: Product Manufacturer.
Author: Imran Khan
Version: 1.2
Author URI: http://codeinform.com/
*/
<?php
/**
* Add the custom tab
*/
function woo_custom_product_tab( $tabs ) {
$tabs['my_custom_tab'] = array(
'title' => __( 'Custom Tab', 'textdomain' ),
'callback' => 'woo_custom_tab_content',
'priority' => 50,
);
<?php
/**
* Rename product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {
$tabs['description']['title'] = __( 'More Detail' ); // Rename the description tab
$tabs['reviews']['title'] = __( 'Ratings' ); // Rename the reviews tab
$tabs['additional_information']['title'] = __( 'Product Data' ); // Rename the additional information tab
<?php
function woo_custom_physical_product_tab( $tabs ) {
global $product;
// Ensure it doesn't show for virtual products
if ( ! $product->is_virtual() ) {
$tabs['shipping'] = array(
'title' => __( 'Shipping', 'textdomain' ),
'callback' => 'woo_custom_shipping_tab',
'priority' => 50,
<?php
/**
* Reorder woocommerce product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_reorder_product_data_tabs', 98 );
function woo_reorder_product_data_tabs( $tabs ) {
$tabs['reviews']['priority'] = 5; // Reviews first
$tabs['description']['priority'] = 10; // Description second
$tabs['additional_information']['priority'] = 15; // Additional information third
<?php
/**
* Remove woocommerce product data tabs
*/
function remove_woo_product_data_tabs( $tabs ) {
//unset will remove the product tabs
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
<?php
// Customize woocommerce product data tabs
function customize_woo_description_tab( $tabs ) {
$tabs['description']['callback'] = 'woo_description_tab_content'; // Custom description callback
return $tabs;
}
<?php
function ci_admin_posts_filter( $query )
{
global $pagenow;
if ( is_admin() && $pagenow=='edit.php' && isset($_GET['ADMIN_SEARCH_FIELD_NAME']) && $_GET['ADMIN_SEARCH_FIELD_NAME'] != '') {
$query->query_vars['meta_value'] = $_GET['ADMIN_SEARCH_FIELD_NAME'];
}
}