Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › Adding menu option to wcfm vendor view
Tagged: WCFM Marketplace
- This topic has 3 replies, 2 voices, and was last updated 5 years, 5 months ago by
WCFM Forum.
- AuthorPosts
- September 13, 2019 at 11:02 am #81434
rajshekhar
ParticipantHello, I am trying to add my own menu option to vendor view of wcfm-maraketplace plugin. I am attaching two files ‘functions.php’ for adding StorePep option and ‘storepep.php’ where my article is located. my problem is when click on storePep my article is not loading properly. so please tell me what are all changes needed for ‘storepep.php’ file.
- September 13, 2019 at 11:07 am #81435
rajshekhar
Participantfile extensions changed for uploading error
- September 13, 2019 at 11:08 am #81436
rajshekhar
Participant`//functions.php
<?php
add_filter(‘wcfm_menus’,’ws_get_wcfm_menus’, 30, 1);
function ws_get_wcfm_menus($wcfm_menus) {
$wcfm_menus[‘ws-storepep’] = array(
‘label’ => __( ‘StorePep’, ‘whiteshop’),
‘url’ => get_wcfm_storepep_url(),
‘icon’ => ‘shield’
);
// errr_log(‘wcfm functions’);
return $wcfm_menus;
}function get_wcfm_storepep_url() {
global $WCFM;
$wcfm_page = get_wcfm_page();
$get_wcfm_settings_url = wcfm_get_endpoint_url( ‘ws-storepep’, ”, $wcfm_page );
return $get_wcfm_settings_url;
}// // ADD storepep VIEW
add_action( ‘before_wcfm_load_views’, function($end_point) { // wcfm_load_views
//$path = __DIR__ . ‘/wcfm/’;
switch( $end_point ) {
case ‘ws-storepep’:
require_once dirname(__FILE__) . ‘/storepep.php’;
break;
}
});add_filter( ‘wcfm_query_vars’, function( $fields ) {
$wcfm_modified_endpoints = (array) get_option( ‘wcfm_endpoints’ );
$fields[‘ws-storepep’] = ! empty( $wcfm_modified_endpoints[‘ws-storepep’] ) ? $wcfm_modified_endpoints[‘ws-storepep’] : ‘ws-storepep’;
return $fields;
});add_filter( ‘wcfm_endpoints_slug’, function( $fields ) {
$fields[‘ws-storepep’] = ‘ws-storepep’;
return $fields;
});add_filter( ‘wcfm_endpoint_ws-storepep_title’, function( $title ) {
$title = __( ‘WS storepep’, ‘wc-frontend-manager’ );
return $title;
});add_action( ‘init’, function() {
global $WCFM_Query;// Intialize WCFM End points
$WCFM_Query->init_query_vars();
$WCFM_Query->add_endpoints();if( !get_option( ‘wcfm_updated_end_point_ws-storepep’ ) ) {
// Flush rules after endpoint update
flush_rewrite_rules();
update_option( ‘wcfm_updated_end_point_ws-storepep’, 1 );
}
} ); - September 15, 2019 at 2:29 am #81749
WCFM Forum
MemberHi,
Please check this sample addon – https://drive.google.com/file/d/1gA0ctUg-OMQ-EMrQjI3-O_79TclKS1o4/view?usp=sharing
Thank You
- AuthorPosts
- You must be logged in to reply to this topic.