Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › Code error about "Add Articles To Store Tabs"
- This topic has 6 replies, 2 voices, and was last updated 4 years, 6 months ago by Sushobhan.
- AuthorPosts
- April 28, 2020 at 9:24 pm #124343sho_amanoParticipant
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. - April 28, 2020 at 9:25 pm #124345sho_amanoParticipant
The PHP version is 5.6.3.
- April 29, 2020 at 10:40 am #124499SushobhanKeymaster
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! - April 29, 2020 at 10:56 am #124504sho_amanoParticipant
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? - April 30, 2020 at 6:16 pm #125063SushobhanKeymaster
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! - April 30, 2020 at 6:29 pm #125079sho_amanoParticipant
Hi,
Thank you so much!!!
I was able to add an article tab without destroying the view! - April 30, 2020 at 9:00 pm #125126SushobhanKeymaster
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.
- AuthorPosts
- You must be logged in to reply to this topic.