Set Links in profile to open in new tab (target="_blank)

This topic contains 5 replies, has 2 voices, and was last updated by  Patrik 4 years, 8 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #7625

    corsto
    Free User
    Post count: 13

    Hi Folks,

    How do i set links in the profile to open in a new tab? for example website links, facebook links and instagram links?

    Thanks

    James Crabb

    #7626

    corsto
    Free User
    Post count: 13

    re upload

    #7634

    Patrik
    Moderator
    Post count: 1971

    Hi,

    You can either use Javascript to do this on your website or override the template or use a filter for the particular links you want to redirect. For social links, you can override the bootstrap/button-group.php file in your theme and add target=”_blank” to the link.

    Regards,
    Patrik

    #7649

    corsto
    Free User
    Post count: 13

    If i override the button-group.php file i will need to update it after every plugin update.

    I don’t use a theme (Oxygen Builder) so my process will be a little different. So i use this process https://wpdevdesign.com/a-basic-wordpress-custom-functionality-plugin/

    For anyone wanting to know.

    #7650

    corsto
    Free User
    Post count: 13

    Do you have any filters i can call to create the same functionality like below

    
    
    add_filter( 'woocommerce_locate_template', 'intercept_wc_template', 10, 3 );
    /**
     * Filter the cart template path to use cart.php in this plugin instead of the one in WooCommerce.
     *
     * @param string $template      Default template file path.
     * @param string $template_name Template file slug.
     * @param string $template_path Template file name.
     *
     * @return string The new Template file path.
     */
    function intercept_wc_template( $template, $template_name, $template_path ) {
    
    	$template_directory = trailingslashit( plugin_dir_path( __FILE__ ) ) . 'woocommerce/';
    	$path = $template_directory . $template_name;
    
    	return file_exists( $path ) ? $path : $template;
    
    }

    this allows me to Filter the cart template path to use cart.php in this plugin instead of the one in WooCommerce. Can i do something similar with Userswp?

    #7653

    Patrik
    Moderator
    Post count: 1971

    Hi,

    The templates you override in your theme will not be needed to update at every plugin updates as updates only overwrite the files in the plugin and not in the theme. So, create a folder called userswp/bootstrap and put the button-group.php in that with the modifications you needed and let me know if it helps.

    Regards,
    Patrik

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

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

Open Support Ticket