Force article_image field to accept multiple images without a plugin

Plugins come and go but also bugs are suppressed. The code is based on a bug/feature of Textpattern where the article_image field also behaves as a custom_field. There are a number of plugins which can achieve this but here is a native method.

Assign article_image to a custom field

<txp:article_custom id='<txp:article_id />'>
	<txp:variable name="aimg" value='<txp:custom_field name="article_image" />' />
		<txp:if_variable name="aimg" value="">
		<txp:hide>if there is no value in the article_image field show nothing</txp:hide>
		<txp:else />
		<txp:images id='<txp:variable name="aimg" />' limit="10">
			<txp:image />
		</txp:images>
	</txp:if_variable>
</txp:article_custom>

All one needs to do is add the a comma separated list of article ids in the article_image field and the images will show in the page.

For further reading on this method or to see an example of how to use it to create an image gallery, see Display the first image from a list in the article image field or Galleriffic image gallery without any plugins.

comments powered by Disqus