Skip to content

Instantly share code, notes, and snippets.

Avatar

Kashif Rafique logichub

View GitHub Profile
View Endo-Stock-Report-Exporter.php
<?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 Aug 22, 2019 — 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.
View template-stock-report.php
<?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 Feb 10, 2019
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
View vendor-orders.php
<?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 Feb 10, 2019
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
View lh_wcmp_vendor_custom_sales_report.php
<?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 Jan 24, 2019 — forked from birgire/woo-product-attributes-bulk-modifier.php
WordPress: Woocommerce Product Attributes - Bulk Modifier ( from custom to taxonomy attributes)
View woo-product-attributes-bulk-modifier.php
<?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
*/
/**
View theeventscalendar-data-export.json
{
"namespace":"tribe\/events\/v1",
"routes":{
"\/tribe\/events\/v1":{
"namespace":"tribe\/events\/v1",
"methods":[
"GET"
],
"endpoints":[
{
View theeventscalendar-swagger-export.json
{
"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 Mar 21, 2022 — forked from philhoyt/advanced-custom-fields-post-title.php
Using Advanced Custom Fields to create Post Title & Slug for different CPTs
View acf-cpt-custom-post-title-slug.php
<?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 Sep 27, 2017 — forked from franz-josef-kaiser/wpmail_exceptions.php
WP Mail Error/Exception handling and SMTP settings
View wpmail_exceptions.php
<?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 )
{
View post-type-taxonomy-setup.php
<?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'),