Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Sabuj Kundu manchumahara

🎯
Focusing
View GitHub Profile
@manchumahara
manchumahara / gist:0e1710721ab5741b68f3e8aad84fd8fd
Created Oct 30, 2020
Single Click "Visit Site" Menu in WordPress Admin Bar(Admin Top Menu) https://manchumahara.com/?p=1266&preview=true
View gist:0e1710721ab5741b68f3e8aad84fd8fd
add_action( 'admin_bar_menu', 'admin_bar_menu_visitsite', 999 );
function admin_bar_menu_visitsite( $wp_admin_bar ) {
if ( current_user_can( 'manage_options' ) ) {
$wp_admin_bar->add_node(
array(
'id' => 'visitsite',
'title' => 'Visit Site',
'href' => site_url(),
'meta' => array( 'class' => 'visitsite_adminbar', 'target' => '_blank' ),
@manchumahara
manchumahara / gist:e95124195bbaf37e3f18bd8c535292d9
Last active May 26, 2020
Hide the user_id column in CBX Bookmark admin bookmark listing https://wordpress.org/plugins/cbxwpbookmark/
View gist:e95124195bbaf37e3f18bd8c535292d9
add_filter('cbxwpbookmark_list_admin_columns', 'cbxwpbookmark_list_admin_columns_hide_user_id', 10, 1);
function cbxwpbookmark_list_admin_columns_hide_user_id($columns = array()){
if(isset($columns['user_id'])){
unset($columns['user_id']);
}
return $columns;
}
View gist:1a6113fa667186f7e8d950a4bbc42462
{
"version": "7",
"about": "This is a Prepros (https://prepros.io) configuration file. You can commit this file to a git repo to backup and sync project configurations.",
"config": {
"proxy": {
"enable": true,
"target": "http://localhost/ambient",
"useLocalAssets": false
},
"reload": {
View gist:684056f4eac4ad8cdec584fb0177e898
apply_filters('cbxwpbookmark_login_html', $cbxwpbkmark_login_html, $login_url, $redirect_url);
add_filter('cbxwpbookmark_login_html', 'cbxwpbookmark_login_link_change', 10, 3);
function cbxwpbookmark_login_link_change($cbxwpbkmark_login_html, $login_url, $redirect_url){
//$login_url is the redirect url you need
$login_url = ''; //set your custom login url here
$cbxwpbkmark_login_html = 'To login <a href="'.esc_url($login_url).'">click</a> here'; //set login form or html as need to display as your custom login
View gist:ca82c850a0ee47cd715a8381dbb6187e
[cbfccountdown type=”kk” plugin=”events-manager” id=”” category=”airsoft”][/cbfccountdown] //should not work because of the wrong double qute ”kk” , double quote should be "kk"
[cbfccountdown type="kk" plugin="events-manager" id="" category="airsoft"][/cbfccountdown] //should work but
here param id and category both can not be used same time, if you use both then id will be take and category will be ignored.
now, id value is any event post id. if you use this shortcode in any event post page then you can ignore the id and
category as it will take the id automatic. now what category does, you can ignore id and use category to display the latest event from that category.
View gist:2afebd0d14790e77e1c93f74e7f5ab71
add_filter( 'woocommerce_shortcode_products_query',
function ( $query_args, $attributes, $type ) {
if ( $type == 'best_selling_products' ) {
unset( $query_args['meta_key'] );
unset( $query_args['meta_query'] );
add_filter( 'posts_clauses',
function ( $args ) {
View gist:35e846858fca18424c2b55e20878ea90
//save_topic_meta_boxes method is hooked from 'save_post'
//this just code sample from my code
/**
* Save topic meta boxes
*
* @param $topic_id
*
* @return mixed
@manchumahara
manchumahara / gist:388e64886fe34c280e909346c763bc03
Created Dec 30, 2019
display order status list in my orders in woocommerce https://codeboxr/.com
View gist:388e64886fe34c280e909346c763bc03
add_action( 'woocommerce_before_account_orders', 'woo_my_orders_display_status' );
function woo_my_orders_display_status( $has_orders = false ) {
//if($has_orders){
$post_status = isset( $_REQUEST['post_status'] ) ? sanitize_text_field( $_REQUEST['post_status'] ) : 'all';
$order_page_url = get_permalink( wc_get_page_id( 'orders' ) );
echo '<div class="clear clearfix"></div>';
View ga for amarhabiganj
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-87486323-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-87486323-2');
</script>
View gist:412ed2f930e24a1a4277639c70bf2912
echo do_shortcode('[cbxwpbookmarkbtn object_id="'.$post->ID.'" object_type="'.$post->post_type.'"]');
//echo do_shortcode('[cbxwpbookmarkbtn]');
You can’t perform that action at this time.