Skip to content

Instantly share code, notes, and snippets.

View fencermonir's full-sized avatar

Md. Monir Hossain fencermonir

View GitHub Profile
@dautienkt
dautienkt / PY0101EN-3-4-Classes.ipynb
Created February 23, 2020 03:29
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/* -----------------------------------------------------------------------------
* REST API SETUP
* -------------------------------------------------------------------------- */
add_action( 'rest_api_init', function () {
register_rest_route( 'users', '/auth/', array(
'methods' => 'POST',
'callback' => 'meditation_user_auth'
) );
} );
@sudipto-me
sudipto-me / Upload media image from a form in wordpress
Created August 18, 2018 09:38
This snippet gives the code for uploading image from media. This click event will open the media directory of the wordpress and gives u privilege to upload media image. Happy Coding. Peace
$('#similar_product_two_upload_image_button').on('click', function(e) {
e.preventDefault();
var send_attachment_bkp = wp.media.editor.send.attachment;
wp.media.editor.send.attachment = function(props, attachment) {
$('.similar_product_two_upload_src').attr('src', attachment.url);
$('#similar_product_two_upload_image').attr('value', attachment.url);
wp.media.editor.send.attachment = send_attachment_bkp;
}
wp.media.editor.open();
return false;
@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' => '=',
@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
@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(
@thinhbg59
thinhbg59 / demo.php
Last active November 21, 2021 08:06
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
@OriginalEXE
OriginalEXE / pe-customize-controls.css
Last active June 26, 2023 05:07
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%);
}
@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()
{
@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() {