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
/**
* 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
/**
* 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
/*
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
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
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
/*
Template Name: Manufacturer
*/
?>
<?php get_header(); ?>
<section id="primary">
<div id="content" role="main" style="width: 100%">
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
<?php
//Frontend Product detail page
function display_manufacturer()
{
global $product;
$id = $product->id;
$manufacturer = get_post_meta( $id, 'meta_box_manufacturer', true );
echo "<p><b>Manufacturer:</b> $manufacturer</p>";
<?php
/**
* Add new "Manufacturer" column to products list
*/
add_filter( 'manage_edit-product_columns', 'add_product_manufacturer' );
function add_product_manufacturer( $columns ) {
$columns['meta_box_manufacturer'] = 'Manufacturer';
return $columns;
}
/**
<?php
if( !function_exists( 'manufacturer_post_type' ) ){
function manufacturer_post_type(){
$labels = array(
'name' => __( 'manufacturer'),
'singular_name' => __( 'manufacturer' ),
/*'menu_name' => __( 'All Manufactuers'),*/
'all_items' => __( 'Manufacturer'),
'add_new' => __('Add New'),
'add_new_item' => __('Add New manufacturer'),
<?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/
License: GPL2
*/