[Resolved] Insert a wp_show_post in each post

Home Forums Support [Resolved] Insert a wp_show_post in each post

Home Forums Support Insert a wp_show_post in each post

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #1357540
    Stephane

    Hello

    Do you know how to insert at the end of each posts:

    [wp_show_posts id=”20502″]

    <p><!– Using the Simple List –></p>

    Regards,

    Stef

    #1357643
    David
    Staff
    Customer Support

    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:

    https://docs.generatepress.com/article/hooks-visual-guide/

    #1357721
    Stephane

    Hi david,

    Thx. It works.

    Do you know how to display like this? (title on the image). Currently, it appears like this

    In the hook, I’ve inserted :
    <?php if ( function_exists( 'wpsp_display' ) ) wpsp_display( 20502 ); ?>

    Regards

    Stef

    #1357730
    David
    Staff
    Customer Support

    With the Dispatch site you need to wrap your code like so:

    <div class="wpsp-card">
    <!-- add your function here -->
    </div>
    #1357758
    Stephane

    Nothing display with:
    <hr >

    <?php if ( function_exists( ‘wpsp_display’ ) ) wpsp_display( 20502 ); ?>
    #1357877
    David
    Staff
    Customer Support

    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>
    #1358095
    Stephane

    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>
    #1358114
    David
    Staff
    Customer Support

    Can you disable autoptimize

    #1358127
    Stephane

    I tried without results

    #1358147
    Stephane

    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.

    #1358148
    David
    Staff
    Customer Support

    Yeah – i don’t think it likes the function. Shortcode is good 🙂

    #1358173
    Stephane

    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.

    #1358401
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Can you explain a bit more about what isn’t working, exactly? The card styles, or something about the posts being queried?

    #1358758
    Stephane

    Hi Tom,

    In fact, I think the mistake was mine. It’s all right.

    Thanks for your help

    Stef

    #1359466
    David
    Staff
    Customer Support

    Glad to hear you got it working!

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.