Code error about "Add Articles To Store Tabs"

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!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Ultimate Code error about "Add Articles To Store Tabs"

Viewing 6 reply threads
  • Author
    Posts
    • #124343
      sho_amano
      Participant

      I’d like to add an article tab to the vendor’s store page, similar to the article below.

      Add Articles To Store Tabs
      https://wclovers.com/forums/topic/add-articles-to-store-tabs/

      So I added the code from the following post using “Code Snippets”, but the screen layout was broken and an error occurred.
      The server logs are as follows.

      Got error ‘PHP message: PHP Fatal error: Call to undefined function rehub_option() in /var/www/vhosts/facethemusic.jp/httpdocs/wp-content/plugins/code-snippets/php/snippet-ops.php(446) : eval()’d code on line 3\n’

      How do I get around this error?

      Attachments:
      You must be logged in to view attached files.
    • #124345
      sho_amano
      Participant

      The PHP version is 5.6.3.

    • #124499
      Sushobhan
      Keymaster

      Hi,
      This code snippet will only work for Rehub theme. I believe you are using a different theme and hence the error!
      Looking forward to helping you!

    • #124504
      sho_amano
      Participant

      Oh! I got it! I hadn’t read the thread closely enough!
      I’m using the KLEO theme, can I add an article tab to the vendor’s store page in the same way?

    • #125063
      Sushobhan
      Keymaster

      Hi,
      Each theme has it’s own structure, so we keep this part flexible with hooks. Use the following snippet for this purpose, though you might need to write some css to make the look consistent.

      add_filter( 'wcfm_is_allow_store_articles', '__return_true' );
      
      add_action( 'wcfmmp_before_store_article', function($author_id) {
          get_template_part( 'page-parts/general-before-wrap' );
      } );
      
      add_action( 'wcfmmp_before_store_article_loop', function($author_id) {
          $blog_type = sq_option( 'blog_type', 'masonry' );
          $blog_type = apply_filters( 'kleo_blog_type', $blog_type );
      
          if ( sq_option( 'blog_switch_layout', 0 ) == 1 ) { /* Blog Layout Switcher */
              kleo_view_switch( sq_option( 'blog_enabled_layouts' ), $blog_type );
          }
          do_action( 'kleo_before_blog_outer_content' );
          if ( $blog_type == 'masonry' ) {
          ?>
              <div class="row responsive-cols kleo-masonry per-row-<?php echo sq_option( 'blog_columns', 3 ); ?>">
          <?php
          }
      } );
      
      add_action( 'wcfmmp_store_article_template', function($author_id) {
          $blog_type = sq_option( 'blog_type', 'masonry' );
          $blog_type = apply_filters( 'kleo_blog_type', $blog_type );
          if ( $blog_type != 'standard' ) {
              get_template_part( 'page-parts/post-content-' . $blog_type );
          } else {
              get_template_part( 'content', get_post_format() );
          }
      } );
      
      add_action( 'wcfmmp_after_store_article_loop', function($author_id) {
          //Specific class for post listing */
          $blog_type = sq_option( 'blog_type', 'masonry' );
          $blog_type = apply_filters( 'kleo_blog_type', $blog_type );
          
          if ( $blog_type == 'masonry' ) {
              echo '</div>';
          }
          // page navigation.
          kleo_pagination();
      } );
      
      add_action( 'wcfmmp_store_article_template_none', function($author_id) {
          // If no content, include the "No posts found" template.
          get_template_part( 'content', 'none' );
      } );
      
      add_action( 'wcfmmp_after_store_article', function($author_id) {
          do_action( 'kleo_after_blog_outer_content' );
          get_template_part( 'page-parts/general-after-wrap' );
      } );

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/
      Let me know how this goes.
      Thanks!

    • #125079
      sho_amano
      Participant

      Hi,
      Thank you so much!!!
      I was able to add an article tab without destroying the view!

    • #125126
      Sushobhan
      Keymaster

      You are always welcome 🙂
      Let me know if there’s anything else we can help you with.
      Can we ask for a favor? Would you mind taking a few minutes to review our plugin (if you haven’t already) at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers.

Viewing 6 reply threads
  • You must be logged in to reply to this topic.