Archived topic
Insert a wp_show_post in each post
14 replies · Started by Stephane on July 9, 2020
Hello
Do you know how to insert at the end of each posts:
<p><!-- Using the Simple List --></p>
Regards,
Stef
Hi there,
you can add shortcodes to a Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
The after_main_content hook places it below the posts content. You can see hook positions here:
With the Dispatch site you need to wrap your code like so:
<div class="wpsp-card">
<!-- add your function here -->
</div>
Nothing display with:
<hr >
Try this code - making sure your WPSP lists ID is 20502
<div class="wpsp-card">
<?php if ( function_exists( 'wpsp_display' ) ) wpsp_display( 20502 ); ?>
</div>
The ID is ok. It works with
<div>
<?php if ( function_exists( 'wpsp_display' ) ) wpsp_display( 20502 ); ?>
</div>
but not with the class
<div class="wpsp-card">
<?php if ( function_exists( 'wpsp_display' ) ) wpsp_display( 20502 ); ?>
</div>
Can you disable autoptimize
I tried without results
It works with the default wp_show_posts:
<div class="wpsp-card">[wp_show_posts name="Simple"]</div>
<p><!-- Using the Simple List --></p>
I'm going to use it.
Yeah - i don't think it likes the function. Shortcode is good :)
In fact, even if I used the default [wp_show_posts name="Simple"], it doesn't work well.
1. Ok with category, no display with post_tag
2. I select the last posts (date > descending) in the category, but it displays other results.
Hi there,
Can you explain a bit more about what isn't working, exactly? The card styles, or something about the posts being queried?
Hi Tom,
In fact, I think the mistake was mine. It's all right.
Thanks for your help
Stef
Glad to hear you got it working!