Skip to content

Instantly share code, notes, and snippets.

View logichub's full-sized avatar

Kashif Rafique logichub

View GitHub Profile
<?php
/**
* Plugin Name: Endo Stock Report Exporter
* Plugin URI: http://www.endocreative.com
* Description: A custom stock report exporter plugin for WooCommerce
* Version: 1.0.0
* Author: Endo Creative
* Author URI: http://www.endocreative.com
* License: GPL2
*/
@logichub
logichub / template-stock-report.php
Created August 22, 2019 18:50 — forked from mikejolley/template-stock-report.php
WooCommerce - Stock Report. A template page snippet to (if you are logged in as admin) output a list of products/stock (which you are managing stock for) ready for printing.
<?php
/*
Template Name: Stock Report :)
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@logichub
logichub / vendor-orders.php
Last active February 10, 2019 00:32
Conditionally change the default value of `$days_range` from 7 days to 60 or 365 days on the Vendor Dashboard in WC Marketplace plugin - Part 1
<?php
/* See this link: https://gist.github.com/logichub/047b0e785bedbc076a8374f95d60b044
* after creating this file in your child theme as mentioned below:
*/
/*
* The template for displaying vendor orders
* Override this template by copying it to yourtheme/dc-product-vendor/vendor-dashboard/vendor-orders.php
*
@logichub
logichub / lh_wcmp_vendor_custom_sales_report.php
Last active February 10, 2019 00:32
Conditionally change the default value of `$days_range` from 7 days to 60 or 365 days on the Vendor Dashboard in WC Marketplace plugin - Part 2
<?php // Mind the opening php tag!
/* First create a new file in your child theme as mentioned here:
* https://gist.github.com/logichub/c1bfa144f4503d4515b6a01de49c8ce3
* Then put this code in your child theme's 'functions.php' file.
*/
// Conditionally change the default value of `$days_range` from 7 days to 60 or 365 days
function lh_wcmp_vendor_custom_sales_report( $days_range ) {
@logichub
logichub / woo-product-attributes-bulk-modifier.php
Created January 24, 2019 19:32 — forked from birgire/woo-product-attributes-bulk-modifier.php
WordPress: Woocommerce Product Attributes - Bulk Modifier ( from custom to taxonomy attributes)
<?php
/**
* Plugin Name: Product Attributes - Bulk Modifier
* Description: Bulk update 'custom product attributes' to 'taxonomy product attributes'. Supports the GET variables, like: wpq_mode=run&wpq_from=colour&wpq_to=pa_colour&wpq_ppp=10&wpq_offset=0&wpq_post_type=product&wpq_post_status=any. WARNING: Backup DB first!!!
* Plugin Author: birgire
* Plugin URI: https://gist.github.com/birgire/0ed300ae4436fcaf508c
* Version: 0.0.2
*/
/**
{
"namespace":"tribe\/events\/v1",
"routes":{
"\/tribe\/events\/v1":{
"namespace":"tribe\/events\/v1",
"methods":[
"GET"
],
"endpoints":[
{
{
"swagger":"2.0",
"info":{
"version":"1.0.0",
"title":"The Events Calendar REST API",
"description":"The Events Calendar REST API allows accessing upcoming events information easily and conveniently."
},
"host":"wpshindig.com",
"basePath":"\/wp-json\/tribe\/events\/v1\/",
"schemes":[
@logichub
logichub / acf-cpt-custom-post-title-slug.php
Last active September 9, 2022 10:30 — forked from philhoyt/advanced-custom-fields-post-title.php
Using Advanced Custom Fields to create Post Title & Slug for different CPTs
<?php
// Auto fill Title and Slug for 'companies' CPT
function acf_title_companies( $value, $post_id, $field ) {
if ( get_post_type( $post_id ) == 'companies' ) {
$new_title = get_field( 'company_name', $post_id ) . ' ' . $value;
$new_slug = sanitize_title( $new_title );
wp_update_post( array(
@logichub
logichub / wpmail_exceptions.php
Created September 27, 2017 19:10 — forked from franz-josef-kaiser/wpmail_exceptions.php
WP Mail Error/Exception handling and SMTP settings
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: (WCM) PHPMailer Exceptions & SMTP
* Description: WordPress by default returns <code>FALSE</code> instead of an <code>Exception</code>. This plugin fixes that.
*/
add_action( 'phpmailer_init', 'WCMphpmailerException' );
function WCMphpmailerException( $phpmailer )
{
<?php
/* Custom Post Type Setup */
function post_type_jobs() {
$labels = array(
'name' => _x('Jobs', 'post type general name', 'agrg'),
'singular_name' => _x('Jobs', 'post type singular name', 'agrg'),
'add_new' => _x('Add New Job', 'jobs', 'agrg'),
'add_new_item' => __('Add New Job', 'agrg'),
'edit_item' => __('Edit Job', 'agrg'),
'new_item' => __('New Job', 'agrg'),