Support » Fixing WordPress » How to create a Bookmark on post with Pagjnation

  • I have searched for the above topic and haven’t found any result yet… So i thought i should open a topic.
    So, basically a bookmark that grabs the link of the specific page they are at in a paginated post. For example :
    Now the once this link is grabbed i want it to be displayed on another page i create for listing all the bookmarks… Is this possible by any chance… Also an option to remove bookmarks is required too… Sorry am not that great with coding but i do know some of the basics…
    Thank you for any kind of help 😀

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz


    So do you wish to have the same sort of functionality as a browser’s bookmark capability, except restricted to only your site? Of course the UI would be different, but you would like the same functionality, correct?

    You’d need a “bookmark me” button of some sort, perhaps in a sidebar. Clicking it would cause a JS function to run, which gets the current URL and sends an Ajax request to the server. The server side Ajax handler could save the URL in user meta.

    On the bookmarks page, code queries for the user meta saved by the Ajax handler and displays all such URLs saved. A “delete me” button can be after each link. Similar to “bookmark me”, code sends the chosen URL via Ajax. The Ajax handler then finds the URL in post meta and removes it.

    Because this involves both JS and PHP, plus Ajax, it’s all rather involved. But if you break this down into small parts, each part might be something you can manage. Eventually you can string all the parts together and have a functional bookmarking scheme. Probably the most difficult part is getting Ajax to work within WP. If you intend to keep on coding for WP, learning how to manage Ajax is an important skill to develop no matter what. The Ajax section of the Plugin Handbook will help you with Ajax.

    If you can get Ajax working for yourself, I’ll bet you can manage the rest as well. Just don’t get overwhelmed. Focus on one small thing at a time until it works perfectly. Then move on to the next small task. If you get stuck on any specific aspect, someone here should be able to help you out.

    Thank you for the reply @bcworkz are there documentation for these kinda js function, because am not that good with JavaScript as much as PHP…
    Anyways thanks again for helping me out.

    Moderator bcworkz


    Well, there’s the JavaScript Reference. You’ll want to use jQuery to at least make the Ajax request. Pure JS Ajax methods are a PITA. Keep in mind that the WP jQuery runs in noConflict mode and the usual $ shortcut doesn’t work unless a noConflict wrapper is used. For example, instead of $.post();, you use;

    I’ve always found these official references more confusing than helpful as a standalone reference. If you are like me, finding actual examples that do what I want is better than working through reference manuals. The manuals are good for further understanding the example you’ve found, not for figuring out how to do something. Decent search-fu will get you further along than reference manuals IMO.

    Fortunately, your current JS need is mostly limited to getting a specific bit of information and sending it to the server, where PHP takes over. But all the supporting things you need to do so really add up to lots of things that can go wrong. I suggest you first get a rudimentary round trip of Ajax data working. As a first try, you don’t need extra complications confusing the basic functionality. Once you have basic data making successful round trips, then you can build upon that to achieve your actual goals.

    WP is trending towards throwing more and more JS and jQuery into the mix as its UI design gets more elaborate, so learning this stuff is going to be time well spent.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.