Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9080651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:07:15+00:00 2026-06-16T20:07:15+00:00

I have been trying to get bootstrap popovers to work within a WordPress loop

  • 0

I have been trying to get bootstrap popovers to work within a WordPress loop with no success, this is what I have so far :

<?php while($have_posts()): $the_post();
  $excerpt = strip_tags(get_the_excerpt());?>

  <a class="<?php echo the_ID()?>" href="<?php echo the_permalink();?>"><?php echo the_title();?></a>

  <script>
  jQuery('.<?php echo the_ID()?>').mouseenter(function(){
    jQuery(this).popover({
      html: true,
      title: '<?php echo the_title();?>',
      trigger: 'manual',
      placement:'top',
      content:'<?php echo $excerpt;?>'
    }).popover('show');
  });
  </script>
<?php endwhile;?>

This prints what I expect

<a class="5598" href="http://mysite.oom/post/">Post Title</a>

<script>
jQuery('.5598').mouseenter(function(){
  jQuery('.5598').popover({
    html: true,
    title: 'Post Title',
    trigger: 'manual',
    placement:'top',
    content:'Post Excerpt'
  }).popover('show');
});
</script>

etc...

However the popovers aren’t displaying on hover and I’m not getting any script errors, so I’m at a loss for why the popovers aren’t working, I do have jQuery, bootstrap.js, and bootstrap.css included on page load. Any help would be greatly appreciated!

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:07:17+00:00Added an answer on June 16, 2026 at 8:07 pm

    Classes and IDs do not work when it starts with numbers!

    It is well known stuff that when you give class as a number:

    <div class="1234">...</div>
    

    It doesn’t work. In your case, it is like this:

    <script>
    jQuery('.5598').mouseenter(function(){
      jQuery('.5598').popover({
        html: true,
        title: 'Post Title',
        trigger: 'manual',
        placement:'top',
        content:'Post Excerpt'
      }).popover('show');
    });
    </script>
    

    The class is a pure number. 5598. Doesn’t work. So try replacing it with something like:

    <a class="p5598" href="http://mysite.oom/post/">Post Title</a>
    
    <script>
    jQuery('.p5598').mouseenter(function(){
      jQuery('.p5598').popover({
        html: true,
        title: 'Post Title',
        trigger: 'manual',
        placement:'top',
        content:'Post Excerpt'
      }).popover('show');
    });
    </script>
    

    And one more thing I doubt is, the .popover() is a function, that is to be used like instantiation. So, don’t give it under .mouseenter(). Replace the whole script this way:

    <script>
    jQuery(document).ready(function(){
      jQuery('.p5598').popover({
        html: true,
        title: 'Post Title',
        trigger: 'manual',
        placement:'top',
        content:'Post Excerpt'
      })
      jQuery('.p5598').hover(function() {
        jQuery('.p5598').popover('show');
      }, function(){
        jQuery('.p5598').popover('hide');
      });
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to get this thing to work for quite a while
I have been trying to get this code to work for a while now
I have been trying to get Twitter Bootstrap btn-group with dropdown to work for
I have been trying to get this working for a while now and am
I have been trying to get this to work. Basically I have a search
I have been trying to get this to work for most of the day
I have been trying to get nServiceBus to work with Ninject 2.0 as the
I have been trying to get this one section of my UI to immediatly
I have been trying to get the Fusion Charts to work on Android 2.2
I have been trying to get autocomplete to work using jquery. jsFiddle of example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.