How to create a clickable div in a Wordpres theme?

Asked

Viewed 32 times

-1

all right? I’m working on a Wordpress theme and needed to turn an image into a link but I’m not sure which command to use or where to insert. The theme support and guided to tinker with the herosection.php file and I would like to make the herosection-image clickable. How to do?

<?php
$out = '';
$hellotext = rwmb_meta('malina_page_herosection_hellotext') != '' ? rwmb_meta('malina_page_herosection_hellotext') : '';
if( has_post_thumbnail() ){
    $out .='<div class="blog-herosection-image"> ';
    if( $hellotext != '' ){
        $out .= '<div class="herosection_text">'.$hellotext.'</div>';   
    }
    $out .= get_the_post_thumbnail(get_the_ID(), 'full').'</div>';
}
$post_ids = rwmb_meta('malina_page_herosection_posts');
$posts_per_page = rwmb_meta('malina_page_herosection_posts_count');
$nav = rwmb_meta('malina_page_herosection_nav');
$slideshow = rwmb_meta('malina_page_herosection_slideshow');

1 answer

0

Will your link be done manually? If the link is related to the content you need to explain how the structure is and search for it in a relative way as well. To insert the link with the code, test by putting below.

<?php
$out = '';
$hellotext = rwmb_meta('malina_page_herosection_hellotext') != '' ? rwmb_meta('malina_page_herosection_hellotext') : '';
if( has_post_thumbnail() ){
$out .='<a href="#linkaqui"><div class="blog-herosection-image"> ';
if( $hellotext != '' ){
    $out .= '<div class="herosection_text">'.$hellotext.'</div>';   
}
$out .= get_the_post_thumbnail(get_the_ID(), 'full').'</div></a>';
}
$post_ids = rwmb_meta('malina_page_herosection_posts');
$posts_per_page = rwmb_meta('malina_page_herosection_posts_count');
$nav = rwmb_meta('malina_page_herosection_nav');
$slideshow = rwmb_meta('malina_page_herosection_slideshow');

Browser other questions tagged

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