[Support request] Getting Critical Error while Adding Related Post Element

Home Forums Support [Support request] Getting Critical Error while Adding Related Post Element

Home Forums Support Getting Critical Error while Adding Related Post Element

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1925288
    Rohit

    Hello I want to add related Post with help of Elements in my website, but getting critical error and also blog design is mashup.

    https://prnt.sc/1rp64we

    I’m following this tutorial
    https://www.wplogout.com/display-related-posts-in-generatepress-theme/

    #1925405
    David
    Staff
    Customer Support

    Hi there,

    i can’t debug the issues from another users site tutorial.

    But this is the original code i wrote for displaying a related WP Show Posts list in your Hook Element:

    <div class="wpsp-related-posts  grid-container">
        <h2>Related Posts</h2>
    <?php
    if ( is_single() ) {
        $cats =  get_the_category();
        $cat = $cats[0];
    } else {
        $cat = get_category( get_query_var( 'cat' ) );
    }
    
    $cat_slug = $cat->slug;
    $list = get_page_by_title( 'related', 'OBJECT', 'wp_show_posts' );
    
    if ( function_exists( 'wpsp_display' ) && is_object( $list ) ) {
    	wpsp_display( $list->ID, 'tax_term="' . $cat_slug . '"' );
    }
    ?>
    </div>

    And this blog post from the site it was orginally added to explains how – see Related Posts:

    https://gpsites.co/merch/the-single-post/

    MAIN THING TO NOTE. You don’t need to add the WPSP ID to the code above. You just need a WPSP List titled: related

    #1926380
    Rohit

    related post not showing with this code also.

    https://prnt.sc/1rs3m28

    #1926883
    Elvin
    Staff
    Customer Support

    Hi Rohit,

    Can you show us the settings of the Hook Element you’ve placed David’s on?

    Perhaps its missing a display rule location or it’s not hooked to the correct hook.

    Let us know. 🙂

    #1927285
    Rohit
    #1927286
    Rohit

    Show Related post Title only, but related post not visible.

    #1927294
    Elvin
    Staff
    Customer Support

    Do you have WP Show Posts plugin installed and activated?

    That is needed to make wpsp_display() function run. Can you check and confirm?

    #1927362
    Rohit

    it is possible to add without plugin?

    #1927373
    Elvin
    Staff
    Customer Support

    it is possible to add without plugin?

    It’s not possible to make it run without the plugin, unfortunately.

    wpsp_display() is a function taken from the plugin.

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