Moraru Vladut
Moraru Vladut

Reputation: 45

Why doesn't open my link?

I have that code for two tabs

<li>
  <a href="#gallery_place" role="tab" data-toggle="tab">
   <i class="fa fa-picture-o"></i>
   <?php _e("Gallery", ET_DOMAIN); ?>
  </a>
</li>
<li>
  <a href="http://romanianusa.com/post-place?id=<?php the_ID(); ?>">
    <i class="fa fa-history"></i>
    <?php _e("Repost", ET_DOMAIN); ?>
  </a>
</li>

Why of the second <li> does not open, Chrome display my link in bottom but when i click doesn't open the page. What is wrong?

Upvotes: 0

Views: 143

Answers (2)

Moraru Vladut
Moraru Vladut

Reputation: 45

I resolved with that function:

    <script>
function openWindow()
    {
        window.open('http://romanianusa.com/post-place?id=<?php the_ID(); ?>');
    }
</script>

And in my <li>

<i class="fa fa-history" onclick="openWindow()"></i><?php _e("Repost", ET_DOMAIN); ?>

Thanks a lot @Barmar

Upvotes: 0

Barmar
Barmar

Reputation: 781088

If the function the_ID() returns the ID, you need to use echo to get the ID into the URL:

<a href="http://romanianusa.com/post-place?id=<?php echo the_ID(); ?>">

Upvotes: 4

Related Questions