How to modify link in PHP code

Asked

Viewed 74 times

1

The excerpt from the code is this :

<div class="menu-item" ui-sref="albums" ui-sref-active="active" href="/albums"><i class="icon icon-cd"></i> Álbuns</div>

The idea was to link instead of going to "/Albums" to go to any other link I type for example : www.google.com

  • href="aqui_vem_o_link"

  • Type where exactly? Div with href that I know does not exist. This is some wordpress plugin or the problem is with html and js only?

  • is a php site that I have and I can’t change the link from that menu that came in it. .

  • It is still difficult to understand, without details, you are being rather vague, there is no way to know if the doubt is HTML, PHP, Wordpress, javascript. Like I said before, as far as I know href= is not a DIV attribute and you also did not explain where you should "type". Please explain.

  • @Henry I did it and when I click the button nothing happens

  • Jhonatan, nothing happens pq href does not work in DIV :/, please kindly explain in more detail exactly what you want and exactly what you have, I recommend you read https://answall.com/help/mcve, thank you for understanding

  • @Guilhermenascimento I changed the name of the question, there is nothing more Div to solve here, you have not read the question ? read it and see in the body below that I explain that I am trying to modify a PHP code in a menu, direct the link to a url.

  • @jhonatansantos does not have absolutely nothing of PHP there. If you want help, you need to at least be able to explain the problem.

  • First, as I asked, do not use the "Reply" button to add details, we are a Q&A and not a forum, do the Tour to understand this. Second, I’ve seen the code and it has no sense, unless it is a javascript or wordpress plugin or PHP that renders things, but vc did not specify which plugin or theme is this, I have no place to start helping you, you are not informing essential details. Third, please, again in an expensive way I ask you to inform what was requested: Where do you want to type? What theme or plugin is this?

Show 4 more comments

2 answers

2

Links are used with tag <a>. You could use it this way:

<div>
  <a href="meu_link"></a>
</div>

Or with lists:

<ul class="menu">
    <li class="menu-item">
      <a href="meuLink">Item 1</a>
    </li>
</ul>

Note: replace meuLink by the desired link, ex.: http://google.com

1


You can do this in many ways:

<a href="http://www.google.com"><div class="menu-item" ui-sref="albums" ui-sref-active="active"><i class="icon icon-cd"></i> Álbuns</div></a>

Then stylize the element a willingly.

or

<div onclick="location.href='http://www.google.com'" class="menu-item" ui-sref="albums" ui-sref-active="active"><i class="icon icon-cd"></i> Álbuns</div>

and other forms...

<div class="your-music"><h2>Sua Música</h2>
<div onclick="location.href='http://www.google.com'" class="menu-item active" ui-sref="songs" ui-sref-active="active"><i class="icon icon-note"></i> Músicas</div>
<div onclick="location.href='http://www.pt.stackoverflow.com'" class="menu-item" ui-sref="albums" ui-sref-active="active"><i class="icon icon-cd"></i> Álbuns</div>
<div onclick="location.href='http://www.x123VXG.dxy'" class="menu-item" ui-sref="artists" ui-sref-active="active" ><i class="icon icon-mic"></i> Artistas</div></div>
  • it worked out the last code sent. thank you very much man .

  • Cool, welcome to the site, be sure to take into account the tips given in the comments, so you can better enjoy the site. Good Luck.

  • I made the changes you passed it until accepted, but nothing appears in the browser. I already cleaned the cache and etc. but the author of the site told me that you need to compile the file. what would be this ?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.