Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › create new endpoints
- This topic has 7 replies, 3 voices, and was last updated 6 years, 9 months ago by WCfM Forum.
- AuthorPosts
- June 14, 2017 at 12:48 pm #10565FloGuest
Hi,
First, I just love your plugin.But I can’t create new endpoints to display new pages.
And more precisely, I can’t add “ws-contract” to the $wp->query_vars.For instance, i try to create a page with contracts.
Here is what i put in my function’s page in my theme.
add_filter(‘wcfm_menus’,’ws_get_wcfm_menus’, 30, 1);
function ws_get_wcfm_menus($wcfm_menus) {
$wcfm_menus[‘contract’] = array(
‘label’ => __( ‘Contrats’, ‘whiteshop’),
‘url’ => get_wcfm_contract_url(),
‘icon’ => ‘shield’
);
return $wcfm_menus;
}
function get_wcfm_contract_url() {
global $WCFM;
$wcfm_page = get_wcfm_page();
$get_wcfm_settings_url = wcfm_get_endpoint_url( ‘ws-contract’, ”, $wcfm_page );
return $get_wcfm_settings_url;
}// // ADD CONTRACT VIEW
add_action( ‘before_wcfm_load_views’, function($end_point){ // wcfm_load_views
$path = __DIR__ . ‘/wcfm/’;
switch( $end_point ) {
case ‘ws-contract’:
require_once($path . ‘wcfm-view-contract.php’ );
break;
}
});
add_filter( ‘wcfm_query_vars’, function($fields){
$fields[‘ws-contract’] = ! empty( $wcfm_modified_endpoints[‘ws-contract’] ) ? $wcfm_modified_endpoints[‘ws-contract’] : ‘ws-contract’;
return $fields;
});Please, could you help me.
Thank you very much. - June 14, 2017 at 1:10 pm #10566WCfM ForumGuest
Hi Flo,
Really thanks for the appreciation and get in touch with us.
We are really surprise and amazied to see what you have done. It will be pleasure for us to help you.
I have already asked our developers to check your code and if they found anything missing we will send you revised code as well.
I want to mention here onething, in wordpress after adding a new endpoint flushing rewrite rules in essential, otherwise it will throws 404 error.
Hope you didn’t miss that!!
If forget to do so then please update wordpress permalink settings once and recheck your new endpoint.If you have any further query please feel free to contact us anytime.
Thank You
Shhiv Narayan
Support WC Lovers - June 14, 2017 at 5:39 pm #10569florent sarrotParticipant
Hi Dear Support,
Thank you very much for your nice and quick answer.
Obviously i missed that. 🙁
And unfortunately, I’m not really sure what do I need to do.
Do you mean to add flush_rewrite_rules()?
If so, where do you think i can’t write it?Furthermore, when i add an endpoint directly inside init_query_vars in your WCFM_Query class and load style, script and view inside the output function in your WCFM_Frontend_Manager_Shortcode class, it works.
But, i definitively dont want to mess your code 🙂Thank’s again for your help,
- June 14, 2017 at 6:52 pm #10570WCFM ForumKeymaster
Hi Florent,
Your approach is absolutely OK, but you missed some small things.
Please give us a bit time, our developers are creating a working demo for that.
We will send you dummy code soon.Thank You
Shhiv Narayan
Support WC Lovers - June 14, 2017 at 11:32 pm #10575WCFM ForumKeymaster
Hi Florent,
WCfM 2.3.6 just released, kindly update your plugins to the latest version.
As I have promised, PFA for dummy codes:
1. functions.php – Sample coded added at the end, you don’t even need to update permalink everything is there.
2. dummy view file – you may placed under “wcfm” folder in your theme.If you have any further query please feel free to contact us anytime.
Thank You
Shhiv Narayan
Support WC Lovers - June 15, 2017 at 7:37 am #10578florent sarrotParticipant
Dear Support,
Thank you for your quick answer.
I’ll try my best to implement your dummy code and see if it works.
But I’m using a storefront child theme and i can tell you right now, it will need some modification.I’ll be right back to you soon if I have any more problem.
THANK YOU AGAIN!
- June 15, 2017 at 8:16 am #10579florent sarrotParticipant
OMG IT WORKS,
Thanks again dear support.
Did I tell you I Love your plugin.Just a minor things, I add if (class_exists(‘WCFM_Query’)) in add_action( ‘init’, function()).
I will probably contact you again for the controllers.
Thank you,
- June 15, 2017 at 8:55 am #10580WCfM ForumGuest
Hi Florent,
Yeah sure, you may add such checkings, not an issue.
You may contact us anytime for any help regarding WCfM and WooCommerce as well.
Really thanks for appreciating our work. We will be really pleased if you share your happiness with others also by rate us 5/5 at wordpress.org
https://wordpress.org/support/plugin/wc-frontend-manager/reviews/Thank You
Shhiv Narayan
Support WC Lovers
- AuthorPosts
- The topic ‘create new endpoints’ is closed to new replies.