I'm new to MODx. Adding in the post thumbnail creates a visual association for each post or page. How to add post thumbnail on homepage? How to show first image in the post as thumbnail on home page?
As a to WordPress:
Here are two solutions
Create image tv, and manually set image every time when creating a resource.
Create an input filter and apply it to the content field -
snippet get_first_image
:
<?php
preg_match('/<img[^<>]+src=[\'"](?P<src>.+)[\'"][^<>]*>/i', $input, $image);
return $image['src'];
and to get image in main page template:
<img src="[[+content:get_first_image]]">