Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember Tweaks › Bookmark Placement
- This topic has 11 replies, 2 voices, and was last updated 13 years, 3 months ago by jeffw.
-
AuthorPosts
-
August 18, 2011 at 1:24 am #4093jeffwMember
Hi.
I read a comment about bookmark placement and you recommended turning off bookmarks from the plugin then adding your own filter for placement. Well, only problem is that when you turn off bookmarking via the plugin and then go to view bookmarks, it says bookmarking is disabled. Didnt even get to the point of writing a filter because this breaks the whole point.
Any way you can write a simple function and add this functionality please? It would be very beneficial to developers. Thanks.
August 19, 2011 at 12:01 am #35637adminKeymasterCan you please post a link to the post your referring to so I can catch up?
August 19, 2011 at 5:15 am #35638jeffwMemberThere you are.
August 19, 2011 at 11:42 pm #35639adminKeymasterThank you… a lot of users were just embedding the bookmark shortcodes without enabling the features so we added that check.
You can turn check off just by tweaking one line. Open the “eMember_bookmark_utils.php” file and search for the following line of code:
if(!$enable_bookmark) return EMEMBER_BOOKMARK_DISABLED;
once you find it simply delete that line and it won’t do that check anymore.
The filter you need to add is for the following function (this function show the bookmark buttons):
boomark_handler
The above function name has a typo but the computer does’t care about that
August 20, 2011 at 12:20 am #35640adminKeymasterUpdated the function name to correct the typo. So now the function name is:
bookmark_handler
August 20, 2011 at 2:52 am #35641jeffwMemberThanks admin.
August 20, 2011 at 3:08 am #35642jeffwMemberWhat am I supposed to declare for argument 1? There is just one argument, which is $content, and its being defined in the function I thought.
August 20, 2011 at 3:08 am #35643jeffwMemberWhat am I supposed to declare for argument 1? There is just one argument, which is $content, and its being defined in the function I thought.
August 20, 2011 at 7:30 am #35644adminKeymaster$content will be the content of the post that will be passed down to that function by WordPress (you don’t have to call that function… it will get called automatically by WordPress). That function essentially appends the bookmark button in the post content.
So you can either modify that function itself or remove that function from the plugin and add in the same function name with your custom code in your theme’s function.php file.
If you want to just customize the location of the bookmark button then use this tweak:
August 20, 2011 at 2:26 pm #35645jeffwMemberRight, thats what I thought because I saw the global call.
I was trying to add it as a function instead of hooking it.
I.e. if member is logged in, do function boomark_handler();
I want the exact same function, just want to be able to place it wherever I want, in my case, the sidebar.
August 20, 2011 at 10:34 pm #35646adminKeymasterBy default, eMember has the following call… it adds the bookmark to the post content
add_filter('the_content', 'bookmark_handler');
Simply call this function and pass the content of the widget and it will add the bookmark button to that widget.
With that said, I can see what you are trying to do but it may not be possible. You are trying to add bookmark button to the sidebar but the sidebar is outside the WordPress main loop. You cannot do post specific actions outside the WordPress loop because the data is not available there. So yes it will add a bookmark button but when you click on it it needs to save the ID of the post and that information is not available outside the WordPress loop. Not all WordPress filters and hooks work outside the loop.
August 21, 2011 at 4:49 pm #35647jeffwMemberI see. Thought I could recall the_post, but I guess not.
I’m trying to hook it and it still won’t work. Ah well.
-
AuthorPosts
- You must be logged in to reply to this topic.