Images in the creation of wordpress theme

Asked

Viewed 44 times

1

I am creating a wordpress theme of vans for changes, at last, I created a page-vans.php and in it I am showing each van category having small, media, large and extra large, attached as thumbnail an image and this image is shown in the index of the page so when clicked on it lead to the page of the selected van (page-vans.php), the problem is, how can I add another image without being the thumbnail?

To be displayed on the van’s single page?

I thought to add it for the content of the page but then it would enter into the_content() only it would have to filter only the image of the_content()?

1 answer

2


To solve this you could use custom Fields. Using this approach, you can insert one more image in each post and call it in your theme normally.

There are several ways to do this, from a fully manual as well as others with plugin use. I particularly use the Advanced Custom Fields. With it I create a set of fields and assign to a custom post type or a page, for example.

inserir a descrição da imagem aqui

That way when I create a new one or edit one post of the type configured in custom field the field will appear for inserting content.

inserir a descrição da imagem aqui

And in the theme I make the call of the field content:

<?php 
    $imageURL = get_field('imagem');
    echo $imageURL;
    // ou simplesmente
    the_field('imagem');
?>

Browser other questions tagged

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