Home Forums WC Vendors Free Support Show shopname in single product url

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #67336
    ra
    Participant

    I want to show the shop name in the url on singel product pages. I’ve made a start myself. Were it says $post->ID now it should get the shop name. How do I do this?

    add_filter(‘post_type_link’, ‘wpse33551_post_type_link’, 1, 3);
    function wpse33551_post_type_link( $link, $post = 0 ){
    if ( $post->post_type != ‘product’ )
    return $link;

    return home_url( ‘p/’ . $post->ID . ‘/’ . $post->post_name );
    }

    add_action( ‘init’, ‘wpse33551_rewrites_init’ );
    function wpse33551_rewrites_init(){
    add_rewrite_rule(
    ‘p/([0-9]+)?.*?$’,
    ‘index.php?post_type=product&p=$matches[1]’,
    ‘top’
    );
    }

    #67486
    Anna
    Member

    @raxsch
    Hello,
    I am not sure exactly how this would or could be done– however, since you have made a start, it looks like you also would need the post author. The vendor is the post author.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘WC Vendors Free Support’ is closed to new topics and replies.