• Resolved erik2

    (@erik2)


    I know it’s often considered bad practice, but does anyone know how to make GD open links in new browser-tabs?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Stiofan

    (@stiofansisland)

    Hello,

    If you are talking about custom field links they should open in a new window by default if its an external URL, we have a filter to prevent it.

    Maybe we are not talking about the same thing? Can you provide and example link?

    Thanks,

    Stiofan

    Thread Starter erik2

    (@erik2)

    Hi Stiofan,

    I am still on a test-environment. But we can use the demo site:

    https://demos.ayecode.io/elementor-real-estate-directory/

    The links to the detail-pages* should open in a seperate browser-tab. I cannot add target=”_blank” as the links are generated by the script…

    How do I do that?

    Regards,

    Erik

    *e.g.: https://demos.ayecode.io/elementor-real-estate-directory/properties/united-states/pennsylvania/philadelphia/development-land/

    • This reply was modified 2 years, 1 month ago by erik2.
    Plugin Author Stiofan

    (@stiofansisland)

    Ah, i understand you now. If you are using a page builder it might be different but if you are using our shortcodes/blocks then this code snippet will make that happen:

    add_filter('geodir_widget_post_title_output','_my_open_gd_title_new_window',15,6);
    function _my_open_gd_title_new_window($output, $title_tag, $instance, $args, $content, $widget ){
    	
    	return $output ? str_replace('href=','target="blank" href=',$output) : $output;
    }

    Its a bit more complicated to do this for the images but if you really need that let me know and i will provide a snippet.

    Thanks,

    Stiofan

    P.S. you can install the plugni “code snippets” to add the above code snippet.

    Thread Starter erik2

    (@erik2)

    Thank you Stiofan, that works!

    Talking about pagebuilders: I also made a sidebar with “events” with the help of Elementor. (In Elementor, I added GD>Post Meta for adding the link to the event).

    I would like to do the same there (apply a filter hook to open events in new tab). However, I am having a hard time finding the right name of the filter to use… Do you have any tips?

    Regards,

    Erik

    Plugin Author Stiofan

    (@stiofansisland)

    Are you using the pro version? I think it can be done with their post title element if so?

    Stiofan

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘open links in new tab’ is closed to new replies.