How to implement a TOOLSET-TEMPLATE here? Thank you 🙂
<?php if ( have_posts() ) : ?>
<ul>
<?php
while ( have_posts() ) :
the_post();
?>
<li><a href="<?php the_permalink(); ?>" rel="bookmark norewrite" title="<?php the_title_attribute(); ?>" ><?php the_title(); ?></a><!-- (<?php the_score(); ?>)--></li>
<?php endwhile; ?>
</ul>
<?php else : ?>
<p>No related posts.</p>
<?php endif; ?>
Hello and thank you for contacting the Toolset support.
I am sorry, but I am not sure to understand your request. This seems like a partial template from the theme. It seems to display a list of posts' titles as links, and it uses a "the_store" function which I am not familiar with.
Can you elaborate more on what you want to achieve?
In the meantime, I am sure you will find these documentation articles worth reading:
- https://toolset.com/documentation/customizing-sites-using-php/creating-templates-single-custom-posts/
- https://toolset.com/documentation/customizing-sites-using-php/displaying-child-posts/
- https://toolset.com/documentation/customizing-sites-using-php/displaying-parent-posts/
- https://toolset.com/documentation/customizing-sites-using-php/
Hi Jamal, thank you so far. Just forget about the sCore, it´s just a yarpp-thing.
Guess I can boil down the question to: how display a post within the loop in PHP with a TOOLSET-template?
Regards, Achim
I'll assume that you are talking about content templates. You can use the render_view_template function as follow:
//Renders the post $mypost using the Content Template with ID equal to 80
echo render_view_template( 80, $mypost );
It also accepts a 3rd argument $user, read more about it here https://toolset.com/documentation/programmer-reference/views-api/#render_view_template
To render a view, user the render_view function in the same documentation article.
Archive templates are definitely a special case, if that's the case, please elaborate more on your use case so I can understand it better.
Keep in mind that a content template is meant to display ONE post, where as a view is meant to query and display a list of posts. Content templates can be used inside a view's loop to render the current post in the loop. Views can also be used inside content templates.
I hope this helps. Let me know if you have any questions.
Great, that looks good! Thank you 🙂
So in this example, 80 would be the number of the post template?
(I don´t find the difference between template and view hard to understand at all.)
Yes, indeed. 80 is the ID of the content template. You can get it from the URL while editing the content template.
To get the IDs of the views, activate the legacy editor in Toolset->Settings->General(tab)->Editing experience. Then reload the page. This will add the menu item Toolset->Views, and in that list you can get the ID of the views on the first column.