Skip Navigation

[Résolu] 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 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 réponses, has 2 voix.

Last updated by Dido Il y a 8 années et 4 mois.

Assigned support staff: Bigul.

Auteur
Publications
#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

Le forum ‘Types Community Support’ est fermé à de nouveaux sujets et réponses.