We're merging with GenerateBlocks! Learn more here.

[Support request] Use WP Show Posts to Replace Blog Archive Page

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Use WP Show Posts to Replace Blog Archive Page

Tagged: 

Viewing 3 posts - 31 through 33 (of 33 total)
  • Author
    Posts
  • #32531
    elvin
    Moderator

    I think we should change how the terms are taken when we are in a page.

    I’d consider using get_queried_object() and take the term from there.

    Example:

    add_action( 'generate_before_main_content', function(){
        if( is_tax('lieu') ){    
            $term = get_queried_object();
    	    $settings = array(
                'taxonomy' => 'lieu',
                'tax_term' => $term->slug,
            );
    		
            if ( function_exists( 'wpsp_display' ) ) {
                wpsp_display( 78685, $settings );
            }
        }
    });

    so what this exactly does is, if the page is under taxonomy of lieu, it gets the queried term, assigns it as the query setting for WPSP and fire wpsp_display using the taxonomy ‘lieu’ and term slug of the current queried page.

    This way, we’re always whatever the page term is will be the one WPSP uses. So for example, if the queried term of the page is paris-13, the term slug used will be ‘paris-13’ instead of getting a loop of terms.

    #32548
    Nicolas
    Participant

    Thank you very much Elvin, I think you nailed it!

    Using get_queried_object() seems to be the way to go to use WPSP to display the archive page of a custom taxonomy.

    Thanks for your patience.

    #32616
    elvin
    Moderator

    No problem. Glad to be of any help. 😀

Viewing 3 posts - 31 through 33 (of 33 total)
  • You must be logged in to reply to this topic.