Grow your CSS skills. Land your dream job.

Calling Post data in WP by hovering a certain word

  • # December 4, 2012 at 2:01 pm

    For example:

    I create a custom post type called “keyword”
    I create a keyword post called “apple” and type in some content.
    Now, when I create a regular post, and I use the word “apple” in the content and I hover over it, I want to be able display the “keyword apple” content in some kind of box.

    The custom post part is easy. I just need help calling forth the keyword information when I use the matching keyword in a regular post. Does that make sense?

    # December 4, 2012 at 2:09 pm

    Wouldn’t you best using maybe a tooltip plugin for WP?

    # December 4, 2012 at 2:21 pm

    Not really, I want the content shown to be database driven. I want to type it’s information once and use it anywhere. Also I want to use html inside as well.

    # December 4, 2012 at 3:47 pm

    AJAX might be the answer here. Or you can grab the content from outside the loop and initially hide it. And when the user hovers the keyword, display it. Not sure if that’s all possible via PHP alone.

    # December 4, 2012 at 5:31 pm

    Ajax certainly a possibility.

    How’s this: I would run the content through a filter to wrap known “keywords” in a span with a class or something, then, ajax in the content of the matching post when a hover of that word is triggered.

    Does that sound like a solid game plan or is there a better way you think?

    # December 4, 2012 at 6:47 pm

    @noahgelman After doing some research, you might actually be able to do this with PHP. I would post the question on StackOverflow.

    # December 5, 2012 at 12:20 am

    I’ll definitely look into it, thanks Chris

    # December 5, 2012 at 10:38 am

    @noahgelman if you find the answer there, please post a link here.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".