This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'add_meta_boxes', 'manufacturer_meta_box_add' ); | |
function manufacturer_meta_box_add() | |
{ | |
add_meta_box( 'manufacturer-meta-box-id', 'All Manufacturers', 'meta_box_manufacturer', 'product', 'side', 'high' ); | |
} | |
function meta_box_manufacturer( $post ) | |
{ | |
// $post is already set, and contains an object: the WordPress post | |
global $post; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Wcik Manufacturer | |
Plugin URI: http://codeinform.com/woocommerce-custom-plugin-development-from-scratch/ | |
Description: A Woocommerce plugin that add products manufacturer features. | |
Author: Imran Khan | |
Version: 1.0 | |
Author URI: http://codeinform.com/ | |
License: GPL2 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// don't call the file directly | |
if ( ! defined( 'ABSPATH' ) ) exit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check if WooCommerce is active | |
**/ | |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { | |
// Put your plugin code here | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Admin Files | |
require_once ( plugin_dir_path( __FILE__ ) . '/include/admin/post_type.php' ); | |
require_once ( plugin_dir_path( __FILE__ ) . '/include/admin/meta_box.php' ); | |
require_once ( plugin_dir_path( __FILE__ ) . '/include/admin/add_column.php' ); | |
//Frontend Files | |
require_once ( plugin_dir_path( __FILE__ ) . '/include/product-detail.php' ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>"; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
OlderNewer