Skip Navigation

[Resolved] Show post with specific category

This support ticket is created 6 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Author
Posts
#600441

Hi guys. Thanks for the wonderful plugin.
I have a question how to display custom posts on another page.
I created 2 custom post types. One of them - "Service Provider", the second "Enterprise" They are mainly for me and in no way connected (2 lobbies)
And also I created 3 custom post types "Events" "News" "White paper" with the taxonomy "service provider" and "enterprise".
Next, I output each of them ("Events" "News" "White paper") on the page "Service Provider".

<?php
$args = array('post_type' => 'event-webinar',
'posts_per_page' => 1,
'taxonomy' => 'events-for-sp',
'orderby' => 'date',
'order' => 'DESC',
);
$query = new WP_Query($args);
while($query -> have_posts()) : $query -> the_post();
?>
<?php
$eventType = types_render_field("choose-type-ew", array('raw' => false));
$eventLogo = types_render_field("placeholder-for-lobby-ew", array('raw' => true));
$eventTitle = types_render_field("header-title-ew", array('raw' => false));
$eventDate = types_render_field("event-s-date-ew", array('raw' => false));
$eventLocation = types_render_field("event-address", array('raw' => false));
?>
<div>
<span><?php echo $eventType; ?></span>
</div>
<div>
<div></div>
</div>
<div>
<img src="<?php echo $eventLogo; ?>">
<div>
<span>
</span>
<span>
</span>
</div>
</div>
<div>
<div>
<span><?php echo $eventTitle; ?></span>
</div>
<div>
<span><?php echo $eventDate; ?></span>
</div>
<div>
<span><?php echo $eventLocation; ?></span>
</div>
</div>
<div>
<span>
">Register now
</span>
<span >
<a>See All
</span>
</div>
<?php endwhile; ?>

As I did not try - does not work taxonomy. I am shown 1 last post, but I do not want to be selected as a category, it is ignored. In the end - I want to display the last post from each type for the lobby

Unfortunately, I can not use your wonderful view plug-in, although I bought it. This is the customer's wish.

#600644

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Shahars,

Thank you for contacting our support forum.

Its a shame that you are not able to use views as this would be much much simpler if you did.

I'm not seeing any issue with the code and it should work. You say you want to display the last post in the category correct?

Please let me know.
Thanks,
Shane

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