How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask ATLPROG Your Own Question
ATLPROG
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 7260
Experience:  MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
44910485
Type Your Programming Question Here...
ATLPROG is online now

I am currently building a custom Wordpress website. I have

Customer Question

I am currently building a custom Wordpress website. I have taught myself basic HTML, CSS and PHP.I am using the Kleo theme with Buddypress and DW Question and Answer. I have completely redesigned DWQA but would like to add a tooltip that displays specific information about a user from their Buddypress profile. The tooltip should appear when you hover over the users name.I am unsure how to implement this. I know it requires JQuerry but I have not yet learnt it to a high enough standard to be able to implement it.I have read the following article on WPMU Dev:How to Display Random BuddyPress Profile Data (or anything else) with Pretty jQuery TooltipsBut I am still not sure how to implement it.My main confusion is I don't know how to write the markup for the JS.
Submitted: 12 months ago.
Category: Programming
Expert:  Monty replied 12 months ago.

Hi Gavin, My name is Monty.

Wordpress comes prepackaged with a copy of JQuery. Here's a great blog entry to help you on the way: https://premium.wpmudev.org/blog/adding-jquery-scripts-wordpress/?utm_expid=3606929-78.ZpdulKKETQ6NTaUGxBaTgQ.0&utm_referrer=https%3A%2F%2Fwww.google.co.za%2F

To set up the JavaScript files with the functions in your WordPress site, you would need to enqueue them (for reference have a look at https://developer.wordpress.org/reference/functions/wp_enqueue_script/).

JavaScript syntax should be quite familiar to you, as it is very similar to PHP. JQuery allows you to reference HTML elements very simply, i.e. by tags, identifiers and attributes. For example, to reference a SPAN tag where the user's name is ***** ***** HTML markup may look like this:

<span class="buddypress_username" title="information that will appear in the tooltip">John Doe</span>

While your JQuery syntax to reference that element would be similar to this:

$(".buddypress_username").tooltipFunctionName();

Let me know if I can assist further,

Kind Regards

Monty

Related Programming Questions