create new endpoints

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 7 reply threads
  • Author
    Posts
    • #10565
      Flo
      Guest

      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.

    • #10566
      WCfM Forum
      Guest

      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

    • #10569
      florent sarrot
      Participant

      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,

    • #10570
      WCFM Forum
      Keymaster

      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

    • #10575
      WCFM Forum
      Keymaster

      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

    • #10578
      florent sarrot
      Participant

      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!

    • #10579
      florent sarrot
      Participant

      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,

    • #10580
      WCfM Forum
      Guest

      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

Viewing 7 reply threads
  • The topic ‘create new endpoints’ is closed to new replies.