Skip to content

Instantly share code, notes, and snippets.

View fencermonir's full-sized avatar

Md. Monir Hossain fencermonir

View GitHub Profile
@fencermonir
fencermonir / sidebar_menu_widget.php
Created August 16, 2018 08:55
This script add sidebar menu widget at your WordPress theme.
<?php
class Dvault_Sidebar_Menu extends WP_Widget {
//setup the widget name, description, etc...
public function __construct() {
$widget_ops = array(
'classname' => 'dvault-sidebar-menu-widget',
'description' => 'Add a custom menu in sidebar. ',
);
@fencermonir
fencermonir / related_post.php
Created August 16, 2018 09:00
This script is for showing related post in WordPress.
/*
*
*
* Get Related Posts
*function to get related post having codition inside
*
*/
function get_related_post($postID){
$themeTemplateDirectoryUri = get_template_directory_uri();
?>
<?php
/* =============================================================================
MCE FILTERS
========================================================================== */
/**
http://wp.tutsplus.com/tutorials/theme-development/adding-custom-styles-in-wordpress-tinymce-editor/
*
inline
Name of the inline element to produce for example “span”. The current text selection will be wrapped in this inline element.
@fencermonir
fencermonir / functions.php
Created August 28, 2018 06:54 — forked from wpscholar/functions.php
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
@fencermonir
fencermonir / wp-conditional-enqueue-new-way.php
Created August 28, 2018 06:58 — forked from obiPlabon/wp-conditional-enqueue-new-way.php
Enqueue IE (Internet Explorer) only scripts and stylesheet in WordPress
<?php
function op_enqueue_scripts() {
wp_enqueue_style(
'op-ie8',
get_template_directory_uri() . '/assets/css/ie8.css',
array(),
'0.0.7'
);
wp_style_add_data( 'op-ie8', 'conditional', 'IE 8' );
@fencermonir
fencermonir / browser-body-class.php
Created August 28, 2018 07:56 — forked from james2doyle/browser-body-class.php
Add a custom body class to WordPress for the current browser being used. No external frameworks or plugins.
<?php
function custom_body_classes($classes)
{
// the list of WordPress global browser checks
// https://codex.wordpress.org/Global_Variables#Browser_Detection_Booleans
$browsers = ['is_iphone', 'is_chrome', 'is_safari', 'is_NS4', 'is_opera', 'is_macIE', 'is_winIE', 'is_gecko', 'is_lynx', 'is_IE', 'is_edge'];
// check the globals to see if the browser is in there and return a string with the match
$classes[] = join(' ', array_filter($browsers, function ($browser) {
@fencermonir
fencermonir / BookList.txt
Created August 28, 2018 19:23
Book List
১. যদ্যপি আমার গুরু - আহমদ ছফা
২. বদলে যান এখনই - তারিক হক
৩. রাজনৈতিক আদর্শ - বার্ট্রান্ড রাসেল
৪. আর্ট অব ওয়ার - সান জু
৫. অন দ্য শর্টনেস অব লাইফ - সেনেকা
৬. বেগম মেরী বিশ্বাস - বিমল মিত্র
৭. কবি - তারাশঙ্কর বন্দ্যোপাধ্যায়
৮. সুবর্ণলতা - আশাপূর্ণা দেবী
৯. নারী - হুমায়ুন আজাদ
১০. প্রদোষে প্রাকৃতজন - শওকত আলী
@fencermonir
fencermonir / term-meta.php
Created August 30, 2018 07:18 — forked from chrisdc/term-meta.php
Add a custom meta box to the new/edit category pages. The meta data is saved to the array term_meta[], which can handle further fields in the future. Based on: https://pippinsplugins.com/adding-custom-meta-fields-to-taxonomies/
<?php
/**
* Add a custom meta box to the new/edit category pages.
* The meta data is saved to the array term_meta[], which can handle further
* fields in the future.
*
* Based on: https://pippinsplugins.com/adding-custom-meta-fields-to-taxonomies/
*/
/**
@fencermonir
fencermonir / wysiwyg-meta-box.php
Created August 30, 2018 07:21 — forked from retgef/wysiwyg-meta-box.php
How to add a Wordpress WYSIWYG editor to a meta box.
<?php
define('WYSIWYG_META_BOX_ID', 'my-editor');
define('WYSIWYG_EDITOR_ID', 'myeditor'); //Important for CSS that this is different
define('WYSIWYG_META_KEY', 'extra-content');
add_action('admin_init', 'wysiwyg_register_meta_box');
function wysiwyg_register_meta_box(){
add_meta_box(WYSIWYG_META_BOX_ID, __('WYSIWYG Meta Box', 'wysiwyg'), 'wysiwyg_render_meta_box', 'post');
}
@fencermonir
fencermonir / functions.php
Created August 30, 2018 09:37 — forked from dasbairagya/functions.php
Add a WYSIWYG Field to WooCommerce Product Category Page
<?php
/********************************************Add a custom filed in the categoy*************************/
add_action( 'init', 'wpm_product_cat_register_meta' );
/**
* Register details product_cat meta.
*
* Register the details metabox for WooCommerce product categories.
*
*/
function wpm_product_cat_register_meta() {