Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Create Custom Functions to Render Bookmark Button */
- function custom_bookmark_button( $post_id ) {
- /* need to flag if this can render login form */
- add_filter( 'jnews_can_render_account_popup', '__return_true' );
- if ( is_plugin_active( 'jnews-bookmark/jnews-bookmark.php' ) ) {
- wp_enqueue_style( 'jnews-bookmark', JNEWS_BOOKMARK_URL . '/assets/css/plugin.css', array(), JNEWS_BOOKMARK_VERSION, 'all' );
- wp_enqueue_script( 'jnews-bookmark', JNEWS_BOOKMARK_URL . '/assets/js/plugin.js', array( 'jquery' ), JNEWS_BOOKMARK_VERSION, true );
- $bookmark_status = get_user_meta( get_current_user_id(), 'jnews_bookmark_article', true );
- $bookmark_status = '' !== $bookmark_status ? $bookmark_status : array();
- $class = 'fa fa-bookmark-o';
- $status = false;
- if ( array_key_exists( $post_id, (array) $bookmark_status ) && $bookmark_status[ $post_id ]['status'] === true ) {
- $class = 'fa fa-bookmark';
- $status = true;
- }
- $output = '<div class="jeg_meta_bookmark">
- <a href="#" data-id="' . $post_id . '" data-added="' . $status . '" data-message><i class="' . $class . '"></i></a>
- </div>';
- echo jnews_sanitize_by_pass( $output );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement