Skip to content

Instantly share code, notes, and snippets.

View manchumahara's full-sized avatar
💭
Life is beautiful!

Sabuj Kundu manchumahara

💭
Life is beautiful!
View GitHub Profile
@manchumahara
manchumahara / gist:d1f234358e1c362d561a516b9958ee03
Last active December 22, 2017 10:20
Check if the post is bookmarked by user (user id or by current logged in user) https://codeboxr.com/documentation-for-cbx-bookmark-for-wordpress/
//check if the current user has bookmarked any post
if(class_exists('CBXWPBookmarkHelper')){
$current_user = wp_get_current_user();
$user_id = $current_user->ID ;
global $post;
$post_id = $post->ID; //if you are trying outside of
$bookmark_by_user = CBXWPBookmarkHelper::isBookmarkedUser($post_id, $user_id); //true or false
@manchumahara
manchumahara / gist:043cb79fc98e9ea5939354af50e22766
Created December 17, 2017 06:54
Check if any post is bookarked by any post by id for CBX Bookmark for Wordpress https://codeboxr.com/documentation-for-cbx-bookmark-for-wordpress/
if(class_exists('CBXWPBookmarkHelper')){
$post_id = ''; put post id here
//check if post is bookmarked once for post id $post_id
$is_bookmarked = CBXWPBookmarkHelper::isBookmarked($post_id);
//is_bookmarked is true or false
}
@manchumahara
manchumahara / gist:f5ed5deaa092fa943062f1f864bf5879
Created December 17, 2017 06:51
Get total bookmark count of any post by id for CBX Bookmark for Wordpress https://codeboxr.com/documentation-for-cbx-bookmark-for-wordpress/
if(class_exists('CBXWPBookmarkHelper')){
$post_id = ''; put post id here
//get total bookmark count for post id $post_id
$bookmark_count = CBXWPBookmarkHelper::getTotalBookmark($post_id);
}
add_filter('get_next_post_sort', 'cbx_custom_get_next_post_sort', 10, 2); //first param query, 2nd param $post object
add_filter('get_previous_post_sort', 'cbx_custom_get_previous_post_sort', 10, 2); //first param query, 2nd param $post object
/**
* Filter get next adjacent post sort sql
*
* @param $sort_sql
* @param $post
*
quicktags({id : 'id_of_the_html_div'});
tinyMCE.execCommand('mceAddEditor', false, 'id_of_the_html_div');
global $wpdb;
//old name
$table_booking_logs_old = $wpdb->prefix . 'rbookinglogs';
$table_branch_manager_old = $wpdb->prefix . 'branch_manager';
//new name
$table_booking_logs = $wpdb->prefix . 'cbxrbooking_log_manager';
$table_branch_manager = $wpdb->prefix . 'cbxrbooking_branch_manager';
if (!function_exists('cbxbookmarkmypost_html')) {
function cbxbookmarkmypost_html($instance, $echo = false)
{
$limit = isset($instance['limit']) ? intval($instance['limit']) : 10;
$orderby = isset($instance['orderby']) ? esc_attr($instance['orderby']) : 'id';
$order = isset($instance['order']) ? esc_attr($instance['order']) : 'desc';
$type = isset($instance['type']) ? esc_attr($instance['type']) : ''; //object type(post types)
<div class="slideritem slider-one text-center item active">
<div class="container-fluid">
<div class="featured-image hidden-sm hidden-xs">
</div>
<div class="featured">
<div class="featured_content">
<h2 class="h1 section-heading">Make Education Free for All</h2>
<p>
Aliquam erat volutpat. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Sed cursus erat ut placerat dictum. <br>
<header id="header">
<div class="container">
<div class="row">
<nav class="navbar ">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#header-navbar-collapse" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@manchumahara
manchumahara / gist:06929e61ed9525eac32b76443ad41ae6
Created July 2, 2017 12:27
how to customize the member profile url for cbx user online wordpress plugin https://wordpress.org/plugins/cbxuseronline/
add_filter('cbxuseronline_member_profile_link', array($this, 'member_profile_link_custom'), 10, 2);
function member_profile_link_custom($profile_link, $userid){
//modify $profile_link as need
return $profile_link;
}