Open Listing in new "window or tab" how to…

This topic contains 4 replies, has 3 voices, and was last updated by  Kiran 4 years, 12 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #523379

    Steve
    Full Member
    Post count: 1019

    https://events2.whatshappeningtoday.com/add-listing/?listing_type=gd_event

    I would like to know if “on a particular page” if the CPT listing can be made to open on a new brower tab/window.

    Thank you.

    Regards,

    S Valencia

    #523384

    Guust
    Moderator
    Post count: 29970

    Can you give more detail?
    Which link and from what page?
    How is the link added now?

    Thanks

    #523410

    Steve
    Full Member
    Post count: 1019

    Good morning Guust.

    It may be that some html open in a new browser can be added to the Site Origin page builder to have it happen. I do not know… but.

    Here is the page: https://events2.whatshappeningtoday.com/add-listing/?listing_type=gd_event

    On the sidebar right, either of the two GD CPT’s would be what I want to have open in a new window. target_blank correct?

    Thank you Guust.

    Have a good day.

    Regards,

    S Valencia

    #523457

    Guust
    Moderator
    Post count: 29970

    You can open all links on that page by adding

    <base target="_blank">

    to the head section of the page using the Header and Footer Scripts plugin.

    To only apply target=”_blank” to the links of particular widgets would require customization. I’ll get a developer to check if there is an easy way, or if you need to find your own developer.

    Thanks

    #523486

    Kiran
    Moderator
    Post count: 7069

    Hi Steve,

    Try following PHP snippet to open listing link in a new tab from add listing page.

    
    
    /**
     * Open listing link in a new tab from add listing page.
     */
    function gd_snippet_191231_super_duper_widget_output( $output, $instance, $args, $super_duper ) {
    	if ( $output != '' && ! empty( $super_duper ) && ! empty( $super_duper->options['base_id'] ) && in_array( $super_duper->options['base_id'], array( 'gd_post_title', 'gd_post_images' ) ) ) {
    		// Add listing page.
    		if ( ! geodir_is_page( 'add-listing' ) ) {
    			return $output;
    		}
    
    		$output = str_replace( array( ' href="http', " href='http" ), array( ' target="_blank" href="http', " target='_blank' href='http" ), $output );
    	}
    
    	return $output;
    }
    add_filter( 'wp_super_duper_widget_output', 'gd_snippet_191231_super_duper_widget_output', 20, 4 );

    Regards,
    Kiran

Viewing 5 posts - 1 through 5 (of 5 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount