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 / 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
*/
/**
@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'),
@logichub
logichub / list-hooked-functions.php
Created September 16, 2017 20:27 — forked from renventura/list-hooked-functions.php
List All Currently Hooked WordPress Functions
<?php //* mind this opening php tag
/**
* This snippet returns a list of all currently hooked functions.
* It is set up to output this data on a specific page. Do not output this data publicly.
* Use this snippet for debugging/testing/development.
* Source: http://www.rarst.net/wordpress/debug-wordpress-hooks/
* Modified by Ren Ventura, EngageWP.com
**/
@logichub
logichub / botscheduler.js
Created April 17, 2017 23:59 — forked from unnikked/botscheduler.js
Bot scheduler for Telegram - to use with IFTTT - please check https://unnikked.ga/build-telegram-bot-hook-io/ for instructions
module['exports'] = function bot (hook) {
var request = require('request');
var TOKEN = hook.env.bot_scheduler_token;
var ENDPOINT = 'https://api.telegram.org/bot' + TOKEN;
console.log(hook.params);
// generic handler to log api call responses
var handler = function (err, httpResponse, body) {
var response = JSON.stringify({
@logichub
logichub / .htaccess
Created May 14, 2016 05:17 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@logichub
logichub / edd_google_tracking_code.php
Created April 28, 2016 11:21 — forked from miguelmich/edd_google_tracking_code.php
Easy Digital Downloads - Google Conversion Tracking Code
<?php
//Google Analytics E-commerce Tracking code
function your_prefix_google_ecommerce_tracking_code() {
$success_page = edd_get_option( 'success_page' ) ? is_page( edd_get_option( 'success_page' ) ) : false;
if ( ! $success_page || !edd_is_success_page() ){
return;
}