This is complete documentation for CBX Bookmark & Favorite for WordPress

3 ways to install

First: From Plugin Directory

  • Navigate to the ‘Add New’ in the plugins dashboard
  • Search for ‘cbxwpbookmark’
  • Click ‘Install Now’
  • Activate the plugin on the Plugin dashboard

Second: Uploading in WordPress Dashboard

  • Navigate to the ‘Add New’ in the plugins dashboard
  • Navigate to the ‘Upload’ area
  • Select `cbxwpbookmark.zip` from your computer
  • Click ‘Install Now’
  • Activate the plugin in the Plugin dashboard

Third: Using FTP

  • Download `cbxwpbookmark.zip`
  • Extract the `cbxwpbookmark` directory to your computer
  • Upload the `cbxwpbookmark` directory to the `/wp-content/plugins/` directory
  • Activate the plugin in the Plugin dashboard

Usages

  • Install the core plugin “cbxwpbookmark” and activate.
  • On activate the plugin creates a page called “My Bookmarks” which contains the shortcode
  • Check the setting page for this plugin from WordPress dashboard left menu Setting->CBX Wp Bookmark Setting
  • Place the widgets in sidebar
  • If you are using Elementor Editor check the elementor widgets
  • If you are using WPBakery Editor check the wpbakery widgets
  • If you are using Gutenberg Editor check the gutenberg blocks

My Bookmark Page/User’s Bookmark Page Setup

On core plugin’s activation we create a page with content or shortcode [cbxwpbookmark-mycat][cbxwpbookmark]
Please note that, we don’t put any param in the shortcode and all default values are used, if you need you can add the param as need.
In version 1.5.3 we introduced alternative way to do this using customizer. If you enable customizer method from plugin’s setting then in the bookmark page the output will not come from shortcode but from the customizer’s setting. To access the customizer setting of CBX Bookmark you can directly go to customizer from dashboard theme option or from the plugin setting. Using a video we will describe more.

Various Shortcode Details

There are 4 shortcodes in core plugin and 4 shortcods in pro addon.

1. Bookmark Button [cbxwpbookmarkbtn] Shortcode(Core)

Where to use: You can disable auto integration for bookmark button and add the boomark button using shortcode,
useful when you want it for specific post.

param name default value possible values
object_id if blank takes default post id any post id
object_type if blank/empty takes post type from the post as found technically from wordpress loop object_type is post type, sometimes custom data type supported natively by this plugin like buddypress posts. post, page etc can be used as object_type, custom post type supported but need pro addon
show_count 1 0,1
extra_wrap_class Exta wrapping html class for bookmark button if you need for style purpose. Introduced in v1.4.1 any string that can be used for html class, default empty
skip_ids Comma separated post id to skip bookmark button. Introduced in v1.4.1 Any post id, default empty
skip_roles skip bookmark button for any user role, for multiple use comma. Introduced in v1.4.1 Example user role administrator, editor, author, contributor, subscriber, default empty

Shortcode can be added in theme directly following this below code snippet

https://gist.github.com/manchumahara/c4761d5c30f309694d0bd269b9fccaf9

2. Bookmark List/My bookmarks/All Bookmarks [cbxwpbookmark] Shortcode(core)

Where to use: Shows logged or any user’s bookmarks

param name default value possible values
title All Bookmarks (As translation string) Any text based title, leave empty to hide. Added in version 1.5.3
userid logged in user id any user id
orderby id id, object_id, object_type, title
order DESC ASC, DESC
limit 0 – means all any numeric value
type post, page, any custom post type, multiple with comma. custom post type support need pro addon
loadmore 1 1 or 0
offset 0 any numeric number
catid any category id, multiple with comma
cattitle 1 Show category title
catcount 1 Shows bookmark count for any category with the category title, 0 or 1
allowdelete 0 if you want to allow delete any bookmark of user’s own in logged in mode, 0 or 1

3. Boommark Categories [cbxwpbookmark-mycat] Shortcode(core)

Where to use: Shows logged or any user’s bookmark category

param name default value possible values
title My Bookmark Categories (As translation string) Any text based title, leave empty to hide. Added in version 1.5.3
userid logged in user id any user id
orderby cat_name id, cat_name, privacy
order ASC ASC, DESC
display 0 0 = list 1= dropdown,
allowedit 0 0 or 1, 1 = allow
show_count 0 0 or 1, 1 = show
show_bookmarks 0 0 or 1, 1 = show bookmark as sub list on click of category, in that case click on category link it will not go through but show bookmarks as sub items.
base_url as set from global setting of plugin from general setting tab base_url is the url on click of category where it takes. We introduced this when we needed to integrate with buddyPress.

4. Most Boomarked posts [cbxwpbookmark-most] Shortcode details

Where to use: Shows most bookmarked posts/items

param name default value possible values
title Most Bookmarked Posts (As translation string) Any text based title, leave empty to hide. Added in version 1.5.3
orderby object_count id, object_id, object_type, object_count, title
order DESC ASC, DESC
limit 10 any numeric value
type post, page or any custom post type, multiple with comma. custom post type support needs pro addon.
daytime 0 as all time ‘0’ as all time, any numeric value as days
show_count 1 1 = show, 0 (shows count)
show_thumb 0 1 = show, 0 (shows thumbnail)
ul_class product_list_widget class name to apply to ul as extra
li_class class name to apply to li as extra

5. Bookmark Grid(All Bookmarks/My Bookmarks) [cbxwpbookmarkgrid] Shortcode(Pro Addon)

Where to use: Shows logged or any user’s bookmarks

param name default value possible values
title All Bookmarks (As translation string) Any text based title, leave empty to hide. Added in version 1.5.3
userid logged in user id any user id
order DESC ASC, DESC
orderby id id, object_id, object_type, title
limit 0 – means all any numeric value
type post, page, any custom post type, multiple with comma. custom post type support needs pro addon.
loadmore 1 1 or 0
offset 0 any numeric number
catid any category id(multiple as comma)
cattitle 1 Show category title
catcount 1 Shows bookmark count for any category with the category title, 0 or 1
allowdelete 0 if you want to allow delete any bookmark of user’s own in logged in mode, 0 or 1
show_thumb 1 0 or 1, 1 = shows thumb, 0 = hide thumbs

6. Most Bookmarked Post Grid [cbxwpbookmark-mostgrid] Shortcode(Pro Addon)
This shortcode is introduced in version 1.5.3
Where to use: Shows most bookmarked posts/items as grid

param name default value possible values
title Most Bookmarked Posts (As translation string) Any text based title, leave empty to hide.
orderby object_count id, object_id, object_type, object_count(object_id is post id, object_type is post type), title
order DESC ASC, DESC
limit 10 any numeric value
type post, page or any custom post type, multiple with comma, don’t use space after comma. custom post type support needs pro addon.
daytime 0 as all time ‘0’ as all time, any numeric value as days
show_count 1 1 = show, 0 (shows count)
show_thumb 0 1 = show, 0 (shows thumbnail)
offset 0 pagination page number, unless you want to display something after ‘x’ page, it’s better to skip this param in shortcode
load_more 0 0 = no, 1 = yes, displays load more feature if total count is more than the limit param.

7. Most Bookmarked Products(Woocommerce) List [cbxwpbookmark-mostproducts] Shortcode(Pro Addon)
This shortcode is introduced in version 1.5.3. This shortcode needs the popular ecommerce plugin WooCommerce to be installed
Where to use: Shows most bookmarked woocommerce products as list

param name default value possible values
title Most Bookmarked Products (As translation string) Any text based title, leave empty to hide.
orderby object_count id, object_id, object_type, object_count(object_id is post id, object_type is post type), title
order DESC ASC, DESC
limit 10 any numeric value
type post, page or any custom post type, multiple with comma, don’t use space after comma. custom post type support needs pro addon.
daytime 0 as all time ‘0’ as all time, any numeric value as days
show_count 1 1 = show, 0 (shows count)
show_thumb 1 1 = show, 0 (shows thumbnail)
show_price 1 1 = show, 0 = hide (shows product price)
show_addcart 1 1 = show, 0 = hide (shows add to cart)

8. Most Bookmarked Downloads(EDD/Easy Digital Downloads) List [cbxwpbookmark-mostdownloads] Shortcode(Pro Addon)
This shortcode is introduced in version 1.5.3. This shortcode needs the popular ecommerce/downloads manager plugin Easy Digital Downloads to be installed
Where to use: Shows most bookmarked woocommerce products as list

param name default value possible values
title Most Bookmarked Downloads (As translation string) Any text based title, leave empty to hide.
orderby object_count id, object_id, object_type, object_count(object_id is post id, object_type is post type), title
order DESC ASC, DESC
limit 10 any numeric value
type post, page or any custom post type, multiple with comma, don’t use space after comma. custom post type support needs pro addon.
daytime 0 as all time ‘0’ as all time, any numeric value as days
show_count 1 1 = show, 0 (shows count)
show_thumb 1 1 = show, 0 (shows thumbnail)
show_price 1 1 = show, 0 = hide (shows product price)
show_addcart 1 1 = show, 0 = hide (shows add to cart)

Elementor Widget

The following widgets(currently 8 widgets (core and pro)) can be accessed from elementor editor. We will keep adding more elementor widgets for this plugin in future as needed.

  1. Bookmark button
  2. My bookmarked posts/All Bookmarks
  3. My bookmark categories(For user category mode)
  4. Most bookmarked posts
  5. My bookmarked posts/All bookmarks Grid (pro)
  6. Most bookmarked posts Grid (pro)
  7. Most Bookmarked Downloads List(EDD) – Pro
  8. Most Bookmarked Products List(Woocommerce) – Pro

Gutenberg Blocks

The following blocks(currently 8 widgets (core and pro)) can be accessed from gutenberg editor. We will keep adding more gutenberg blocks for this plugin in future as needed.

  1. Bookmark button
  2. My bookmarked posts/All Bookmarks
  3. My bookmark categories(For user category mode)
  4. Most bookmarked posts
  5. My bookmarked posts/All bookmarks Grid (pro)
  6. Most bookmarked posts Grid (pro)
  7. Most Bookmarked Downloads List(EDD) – Pro
  8. Most Bookmarked Products List(Woocommerce) – Pro

WPBakery Widgets

The following widgets(currently 8 widgets (core and pro)) can be accessed from wpbakery editor. We will keep adding more wpbakery widgets for this plugin in future as needed.

  1. Bookmark button
  2. My bookmarked posts/All Bookmarks
  3. My bookmark categories(For user category mode)
  4. Most bookmarked posts
  5. My bookmarked posts/All bookmarks Grid (pro)
  6. Most bookmarked posts Grid (pro)
  7. Most Bookmarked Downloads List(EDD) – Pro
  8. Most Bookmarked Products List(Woocommerce) – Pro

Classic Widgets

The following classic widgets(currently 7 widgets (core and pro)) can be accessed from wordpress dashboard widget manager. We will keep adding more classic widgets for this plugin in future as needed. All widgets has shortcode and same params.

  1. My bookmarked posts/All Bookmarks
  2. My bookmark categories(For user category mode)
  3. Most bookmarked posts
  4. My bookmarked posts/All bookmarks Grid (pro)
  5. Most bookmarked posts Grid (pro)
  6. Most Bookmarked Downloads List(EDD) – Pro
  7. Most Bookmarked Products List(Woocommerce) – Pro

For Developer

Showing Bookmark Button Inside Loop or Outside Loop

https://gist.github.com/manchumahara/4d5c84094f0cd5b544dc11017ceedfe7

Get total bookmark count of any post by id

https://gist.github.com/manchumahara/f5ed5deaa092fa943062f1f864bf5879

Get total bookmark count of any category by category id

https://gist.github.com/manchumahara/8ec4ad329bc13bbafc83a8d378313996

Check if any post is bookarked by any post id

https://gist.github.com/manchumahara/043cb79fc98e9ea5939354af50e22766

Check if any post is bookarked by any user by any post id & user id

https://gist.github.com/manchumahara/d1f234358e1c362d561a516b9958ee03

Custom Login Url

The plugin only works for loggedin user and shows a login form for guest. if you don’t want to show the login form in bookmark popup you can override the output and display your own login url instead.

	
		//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 click here'; //set login form or html as need to display as your custom login
		
		  return $cbxwpbkmark_login_html; 
		}
	

Template Override

We have implemented woocommerce like template override system which means, you can to override any template/view layer of this plugin in your theme.
The core plugin has all template files for various display in plugin root(cbxwpbookmark)/templates/
Then there are few folders called admin, bookmarkpost, bookmarkmost, widgets etc folders for relevant template files
To override template files and folders from the “templates” need to copy in your theme or child theme’s root folder’s inside “cbxwpbookmark” folder. The template files override
is just like woocommerce. Please create a folder called “cbxwpbookmark” in your theme/child theme’s root folder and copy files from the
plugin root(cbxwpbookmark)/templates/ dir, same way files from pro addon’s ‘templates’ folder can be copied to active theme/child theme’s “cbxwpbookmark” folder

How to Translate

We are not providing any translation with the plugins but we provide the translate template or pot file inside this plugin’s languages folder which can be translated using standard wordpress translation process. But we recommend to use Loco translate which helps to translate from the wordpress dashboard and very easy. We have a video tutorial about how to use this loco translate plugin

Bookmark Icon

In core plugin bookmark icon is added using css. So the only way to change is override css.
To override the css you need some css skill and the custom css can be added in theme’s style sheet or can be put in customizer’s custom css area.
So, the below code will give the idea.

	
		.cbxwpbkmarktrig-marked:before {
			background: no-repeat url('image url here') 0 0;

		}

		.cbxwpbkmarktrig:before {
			background: no-repeat url('image url here') 0 0;
		}
	

If you are not familiar with custom css then buy the pro addon, it has built in option to add custom icon. Using the pro addon you can also select some ready icon and also override from theme without uploading custom icon but placing custom icon in a specific folder inside the theme. To override icon from theme without writing custom css create folder structure like this — {Your theme root}/cbxwpbookmark/bookmarkicons, child theme location will get high priority. Custom bookmark icon needs to have images named bookmark_before_2x.png, bookmark_after_2x.png and put these images inside the folder {Your theme root}/cbxwpbookmark/bookmarkicons

JS Event

From version 1.5.6 we added custom js event as limited level. Pro addon has a some commented code about how to add the js event but here in documentation we will make it more clear.
1. Hook to add new js
add the js to write the event code. the codes are from our pro addon, you need to adjust the path and others based on the code format

	
		add_action( 'cbxwpbookmark_js_before_cbxwpbookmarkpublicjs', array( $this, 'cbxwpbookmark_js_before_cbxwpbookmarkpublicjs' ) );
		public function cbxwpbookmark_js_before_cbxwpbookmarkpublicjs(){
			wp_register_script( 'cbxwpbookmark-events-test', plugin_dir_url( __FILE__ ) . 'assets/js/cbxwpbookmark-events-test.js', array( 'cbxwpbookmark-events' ), $this->version, true );
			wp_enqueue_script( 'cbxwpbookmark-events-test' );
		}
	

2. Check the js file {your wordpress root}\wp-content\plugins\cbxwpbookmark\assets\js\cbxwpbookmark-public.js and search for “CBXWPBookmarkEvents_do_action” to understand where and why those js events are added.
3. How je events are added or the code of cbxwpbookmark-events-test.js. In this example js file we used same js function as callback to test but you need to put your own custom function as callback for each event’s callback as write your own custom event code. This events are like wordpress filters/hooks. The add_action compatible is CBXWPBookmarkEvents_add_action and add_filter compatible is CBXWPBookmarkEvents_add_filter. For more details study the event manager js file wp-content\plugins\cbxwpbookmark\assets\js\cbxwpbookmark-events.js

	
		'use strict';

if ( typeof window.CBXWPBOOKMARK_FILTERS !== 'undefined' ) {
	function cbxwpbookmark_gust_click_test() {
		console.log('event works');
		console.log(arguments);
	}

	/*CBXWPBookmarkEvents_add_action('cbxwpbookmark_trigger_gust', cbxwpbookmark_gust_click_test, 10);
	CBXWPBookmarkEvents_add_action('cbxwpbookmark_trigger_user', cbxwpbookmark_gust_click_test, 10);
	CBXWPBookmarkEvents_add_action('cbxwpbookmark_trigger_no_cat_pre', cbxwpbookmark_gust_click_test, 10);
	CBXWPBookmarkEvents_add_action('cbxwpbookmark_trigger_no_cat_cats_loaded', cbxwpbookmark_gust_click_test, 10);
	CBXWPBookmarkEvents_add_action('cbxwpbookmark_trigger_cats_pre', cbxwpbookmark_gust_click_test, 10);*!/
	CBXWPBookmarkEvents_add_action('cbxwpbookmark_trigger_nocats_pre', cbxwpbookmark_gust_click_test, 10);

	CBXWPBookmarkEvents_add_action('cbxwpbookmark_trigger_cats_bk_click', cbxwpbookmark_gust_click_test, 10);
	CBXWPBookmarkEvents_add_action('cbxwpbookmark_trigger_cats_bk_response', cbxwpbookmark_gust_click_test, 10);

	CBXWPBookmarkEvents_add_action('cbxwpbookmark_trigger_nocats_bk_click', cbxwpbookmark_gust_click_test, 10);
	CBXWPBookmarkEvents_add_action('cbxwpbookmark_trigger_nocats_bk_response', cbxwpbookmark_gust_click_test, 10);*/
}
	

Last modified: June 15, 2020