Skip Navigation

[Resolved] Image in category

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 10 years, 12 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

This topic contains 4 replies, has 2 voices.

Last updated by Dido 10 years, 11 months ago.

Assisted by: Bigul.

Author
Posts
#83394

I have a few categories on hidden link like hidden link

my problem is: I put the image in a cpt and use this code in my category.php: <?php echo(types_render_field("afbeelding", array("alt"=>"$titel", "title"=>"$titel","width"=>"415","height"=>"415","proportional"=>"true"))); ?>

It works well, but I want to show up the image of the newest post, and not the oldest from the 3 on the page.

how can I fix this?

#83557

Bigul
Supporter

Dear Dido,

Please share the codes you are using to listing the images. You need to rewrite it.

--
With Regards

Bigul

#83566

I made 2 fields.
1 is a textfield (afbeelding) and the other a wywiwyg field. in the wysiwyg field I put a diashow using simple viewer.

This is the whole code I use in the single.php and in the category.php

<div id="cpt">
<?php echo(types_render_field("diashow", array("alt"=>"$titel", "title"=>"$titel", "width"=>"416","height"=>"500","proportional"=>"true"))); ?>

<?php echo(types_render_field("afbeelding", array("alt"=>"$titel", "title"=>"$titel","width"=>"415","height"=>"415","proportional"=>"true"))); ?>
</div>

#83574

Bigul
Supporter

Dear Dido,

Possible solution will be you have to re-order the WP Query from last to first. Then call following types API code.

< ?php echo(types_render_field("diashow", array("alt"=>"$titel", "title"=>"$titel", "width"=>"416","height"=>"500","proportional"=>"true"))); ?>
< ?php echo(types_render_field("afbeelding", array("alt"=>"$titel", "title"=>"$titel","width"=>"415","height"=>"415","proportional"=>"true"))); ?>

Please check this link for more details. http://codex.wordpress.org/Function_Reference/query_posts


With Regards

Bigul

#89606

Thanks Bigul, this was the solution. Because it was a little complicated for me, I asked a programmer to solve it for me. I can use this code for other websites too.
hidden link

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.