Answer the question
In order to leave comments, you need to log in
How to make a link to the desired Wordpess page?
Good afternoon! Please tell me, there is a condition if the category id is something, then such a button is displayed. Clicking on it will take you to the desired page. The question is, how to make links to pages correctly? Since in this form it is probably not done correctly (
Below is the code:
<?php
if( in_category( '2' ) ){
echo '<div class="buttons_categorij">
<form action="http://primer/primer1/">
<button type="submit">Тратата</button>
</form>
</div>';
}elseif ( in_category( '4' ) ){
echo '<div class="buttons_categorij">
<form action="http://primer/primer2/">
<button type="submit">Тратра 2</button>
</form>
</div>';
}
;?>
Answer the question
In order to leave comments, you need to log in
mm... And what for to you the form in that case? Just btn you can
And links to form throughecho get_the_permalink ( $id )
Thank you! Understood) I did this:
<?php
if( in_category( '2' ) ){?>
<a href=" <?php echo get_the_permalink ( 311);?>" class="buttons_categorij"> Предложить новость</a>
<?php }elseif ( in_category( '4' ) ){?>
<a href="<?php echo get_the_permalink (299);?>" class="buttons_categorij">Отправить отчет</a>
<?php } ;?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question