Skip to content

Instantly share code, notes, and snippets.

View fencermonir's full-sized avatar

Md. Monir Hossain fencermonir

View GitHub Profile
@kosmiq
kosmiq / functions.php
Last active October 29, 2018 10:04
Add custom checkout fields, validate if payment method cheque is selected. Validate organisational numbers.
// Remove if you're not checking the input in org_number
include_once( get_stylesheet_directory() . '/pnum.php'); // get from: https://github.com/gurre/php-personnummer/blob/master/pnum.php
add_action( 'woocommerce_after_checkout_billing_form', 'cheque_custom_checkout_field' );
function cheque_custom_checkout_field( $checkout ) {
echo '<div id="cheque_custom_checkout_field"><h3>' . __('Fakturauppgifter') . '</h3>';
woocommerce_form_field( 'org_number', array(
'type' => 'text',
'class' => array('org-number-field my-field-class form-row form-row-wide'),
'label' => __('Organisationsnummer'),
// Shortcode
// source : https://wpbakery.atlassian.net/wiki/pages/viewpage.action?pageId=524362
if(!function_exists('carousel_content')){
function carousel_content( $atts, $content = null ) {
return '<div class="owl-carousel content-carousel content-slider">'.do_shortcode($content).'</div>';
}
add_shortcode('carousel_content', 'carousel_content');
}
@abegit
abegit / wc_order_status_changes.php
Created February 2, 2016 20:11
WooCommerce Hooks for Order Status Changes
function mysite_pending($order_id) {
error_log("$order_id set to PENDING", 0);
}
function mysite_failed($order_id) {
error_log("$order_id set to FAILED", 0);
}
function mysite_hold($order_id) {
error_log("$order_id set to ON HOLD", 0);
}
function mysite_processing($order_id) {
@stephenscaff
stephenscaff / acf-cpt-options.php
Created July 19, 2016 22:35
Adds ACF Options pages to Custom Post Types.
/**
* CPT ACF
*
* Adds a Menu Item for custom post types to add options page fields.
*
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
function ctp_acf_options_pages() {
@tzkmx
tzkmx / get_thumbnail_to_category_rest.php
Created July 21, 2016 00:15
Add thumbnail field to WordPress category via REST API
<?php
add_action('rest_api_init', 'register_my_rest_field');
/**
* It depends on term_meta key _thumbnail_id using the metadata API
* for terms. Only plugin I know uses this is Taxonomy Thumbnail:
* https://wordpress.org/plugins/sf-taxonomy-thumbnail/ instead of
* storing metadata for terms in wp_options or custom tables
*/
function register_my_rest_field()
{
@OriginalEXE
OriginalEXE / pe-customize-controls.css
Last active August 14, 2024 13:15
Extending WordPress Customizer Panels and Sections to allow nesting
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent,
#customize-theme-controls .customize-pane-child.current-section-parent {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
}
@thinhbg59
thinhbg59 / demo.php
Last active March 31, 2025 05:16
Add ux builder shortcode - Flatsome Theme
<?php
/*
Plugin Name: OT Flatsome Ultimate Addons
Plugin URI: https://ninewp.com
Description: OT Flatsome Ultimate Addons
Version: 1.0.0
Author: thinhbg59
Text Domain: OT_FL_Ultimate_Addons
Domain Path: /languages
@fencermonir
fencermonir / wp-query-ref.php
Created October 13, 2017 09:36 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@dfinnema
dfinnema / functions.php
Last active February 18, 2020 11:08
Flatsome UX Builder Addon - Scroll Down
/**
*
* Flatsome UX Builder Addon
*
* adds a scroll to mouse animation to parts of the page
*
* Dependent files (in your child theme):
* /css/scroll.min.css
*
* Parent Theme Supported
@Maden-maxi
Maden-maxi / avada-options.php
Created December 23, 2017 16:32
Filter for avada theme options
<?php
add_filter('avada_options_sections', 'avada_child_options_sections');
function avada_child_options_sections( $sections )
{
$sections['header']['fields']['header_info_1']['fields']['header_layout']['choices']['v8'] = AVADA_CHILD_THEME_DIR_URI . '/assets/img/header-pattern/header-8.png';
$sections['header']['fields']['header_info_1']['fields']['header_number']['required'][] = array(
'setting' => 'header_layout',
'operator' => '=',