Answer the question
In order to leave comments, you need to log in
How to make a clickable banner on the main page of Wordpress?
I installed a picture in the theme header, you need to open another page by clicking this picture. It works, but how to fix the code so that the /test link also opens on the main page when you click on the picture, it works everywhere, except when the main page is open.
<?php
if ( ! empty( $logotype_image ) ) {
if ( is_front_page() ) {
if ( is_home() && is_paged() ) {
echo '<div class="site-logotype"><a href="'. esc_url( home_url( '/test' ) ) .'">' . $logotype_html . '</a></div>';
} else {
echo '<div class="site-logotype">' . $logotype_html . '</div>';
}
} else {
echo '<div class="site-logotype"><a href="'. esc_url( home_url( '/'test ) ) .'">' . $logotype_html . '</a></div>';
}
}
Answer the question
In order to leave comments, you need to log in
If I understood correctly, then you want to write a condition like this
if ( ( is_front_page() || is_home() ) && !is_paged() ) {
echo '<div class="site-logotype">' . $logotype_html . '</div>';
} else {
echo '<div class="site-logotype"><a href="'. esc_url( home_url( '/test' ) ) .'">' . $logotype_html . '</a></div>';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question