What does “not working” mean? Syntactically, it is correct, but the structure is wrong. However, this should not lead to errors.
I got a permanent error, so, what is wrong in the structure? I need a button, when I press the button the visitor is guided directly to the map related to that apartment
I just noticed that you mixed up the quotation marks in the code. That’s what’s causing the error.
If you just want a button, the following is all you need:
echo '<a href="' . get_permalink( get_the_ID() ) . '#my_map_123"><img src="/wp-content/uploads/2023/07/map-3.jpg"/></a>"';
…I’ve seen that I mixed 2 codes, I just needed an image with a link, so I’m using
echo "<a href='".get_permalink( get_the_ID() )."#my_map_123'><img src='/wp-content/uploads/2023/07/map-3.jpg'/></a>" ;
how can I style it? using a <span ID: “xxx”> ? the tag span goes after “echo”? – thank you
When you talk about styling, I would expect a solution using CSS. For example, you can assign colors to a link as follows:
a { background-color: red; }
Of course, you would also have to address the button directly, so give it a class:
echo '<a class="button" href="’ . get_permalink( get_the_ID() ) . '#my_map_123"><img src="/wp-content/uploads/2023/07/map-3.jpg"/></a>';
and then address it via CSS as follows:
a.button { background-color: red; }
Of course, I don’t know what kind of display you want to use at this point. CSS offers a wide range of possibilities, so there is no need to inflate the HTML code.