• Resolved cousinr

    (@cousinr)


    Hello,

    I’m trying to add a new page – a tab for the vendor’s store page. But for some reason it’s not working quite right. Please help me to make it work. When I go to the contacts page, the tab in the store header does not change to active. Even though I’m on the contacts page and I can see the content, for some reason it keeps underlining Goods.


    // Add a new tab for the store page
    function add_contacts_store_tabs( $tabs, $store_id ) {
    $store_url = dokan_get_store_url( $store_id );

    // Add a new tab
    $tabs['contacts'] = array(
    'title' => __( 'Contacts', 'electro-child' ),
    'url' => $store_url . 'contacts/',
    );

    return $tabs;
    }

    add_filter( 'dokan_store_tabs', 'add_contacts_store_tabs', 30, 2 );


    // Processing custom URLs for the tab
    function handle_store_contacts_pages() {
    if ( get_query_var( 'contacts' ) ) {
    $store_name = get_query_var( 'store' );

    if ( ! empty( $store_name ) ) {
    $seller = get_user_by( 'slug', $store_name );

    // Redirects to 404 if seller not found
    if ( ! $seller ) {
    return get_404_template();
    }

    // Loading a custom template for the "Contacts" page
    $template = locate_template( 'store-contacts.php' );
    if ( $template ) {
    load_template( $template );
    exit;
    }

    }
    }

    }

    add_action( 'template_redirect', 'handle_store_contacts_pages' );


    // Register a custom overwrite rule for the tab
    function store_contacts_rewrite_rules() {
    add_rewrite_rule( '^store/([^/]+)/contacts/?$', 'index.php?store=$matches[1]&contacts=1', 'top' );
    }

    add_action( 'init', 'store_contacts_rewrite_rules' );

    // Adding a query variable for "contacts"
    function store_contacts_add_query_vars( $vars ) {
    $vars[] = 'contacts';
    return $vars;
    }

    add_filter( 'query_vars', 'store_contacts_add_query_vars' );

    Please, any help. Thank you

    • This topic was modified 8 months ago by cousinr.
    • This topic was modified 8 months ago by cousinr.
    • This topic was modified 8 months ago by cousinr.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Tanvir Hasan

    (@tanvirh)

    Hi @cousinr

    For the issue you’re encountering with the vendor’s store page tab not updating correctly, we recommend consulting with a professional WordPress and Dokan customization expert. Our support policy does not cover customization of the Dokan default functionality.

    A specialized expert will be able to assist you with making the necessary adjustments to achieve the desired outcome.

    Thanks!

    Plugin Support Tanvir Hasan

    (@tanvirh)

    Hi @cousinr

    As we haven’t heard back from you for a while, we’ll consider this topic resolved. If you encounter any further issues, please don’t hesitate to open a new topic.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Store Tab Page’ is closed to new replies.