Create a shortcode on a Wordpress plugin (WC Vendors)
$10-30 USD
Completed
Posted over 8 years ago
$10-30 USD
Paid on delivery
I have WC vendor install on my wordpress site and I need to create a new shortcode.
I need you to add a filter here so you can choose the category you want ([login to view URL]) (for COMMUNIQUE in this page for exmple the category is "Agence de Publicité". Son I need a list with all the categories so you see only the list of the category choose.
Here are the code :
////////////////////////////
/* list of vendors
*
* @param $atts shortcode attributs
*/
public function wcv_vendorslistsort( $atts ) {
$html = '';
extract( shortcode_atts( array(
'orderby' => 'registered',
'order' => 'ASC',
'per_page' => '12',
'columns' => '4',
'show_products' => 'no'
), $atts ) );
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$offset = ( $paged - 1 ) * $per_page;
// Hook into the user query to modify the query to return users that have at least one product
if ($show_products == 'yes') add_action( 'pre_user_query', array( $this, 'vendors_with_products') );
// Get all vendors
$vendor_total_args = array (
'role' => 'vendor',
'meta_key' => 'pv_shop_slug',
'meta_value' => '',
'meta_compare' => '>',
'orderby' => $orderby,
'order' => $order,
);
if ($show_products == 'yes') $vendor_total_args['query_id'] = 'vendors_with_products';
$vendor_query = New WP_User_Query( $vendor_total_args );
$all_vendors =$vendor_query->get_results();
// Get the paged vendors
$vendor_paged_args = array (
'role' => 'vendor',
'meta_key' => 'pv_shop_slug',
'meta_value' => '',
'meta_compare' => '>',
'orderby' => $orderby,
'order' => $order,
'offset' => $offset,
'number' => $per_page,
);
if ($show_products == 'yes' ) $vendor_paged_args['query_id'] = 'vendors_with_products';
$vendor_paged_query = New WP_User_Query( $vendor_paged_args );
$paged_vendors = $vendor_paged_query->get_results();
// Pagination calcs
$total_vendors = count( $all_vendors );
$total_vendors_paged = count($paged_vendors);
$total_pages = intval( $total_vendors / $per_page ) + ( $total_vendors % $per_page );
ob_start();
// Loop through all vendors and output a simple link to their vendor pages
foreach ($paged_vendors as $vendor) {
wc_get_template( '[login to view URL]', array(
'shop_link' => WCV_Vendors::get_vendor_shop_page($vendor->ID),
'shop_name' => $vendor->pv_shop_name,
'vendor_id' => $vendor->ID,
'shop_description' => $vendor->pv_shop_description,
), 'wc-vendors/front/', wcv_plugin_dir . 'templates/front/' );
} // End foreach
$html .= '<ul class="wcv_vendorslist">' . ob_get_clean() . '</ul>';
if ($total_vendors > $total_vendors_paged) {
$html .= '<div class="wcv_pagination">';
$current_page = max( 1, get_query_var('paged') );
$html .= paginate_links( array(
'base' => get_pagenum_link( ) . '%_%',
'format' => 'page/%#%/',
'current' => $current_page,
'total' => $total_pages,
'prev_next' => false,
'type' => 'list',
));
$html .= '</div>';
}
return $html;
}
///////////////////////End////////////////
Right Now with this code I can create a page with a shortcode like [wcv_vendorslist show_products="no"] thas show me the list of all the vendor, but I have another table called "pv_merchant_category" and I would like to be able to create a page with a shortcode like [wcv_vendorslist show_products="no" category="Barber"] thas will show me only the list of the vendors in the "Barber" category!!
Hi
Hope you are doing great.
I have worked on many Wordpress Plugin and Shortcode projects.
I am ready to start now, if you are interested.
I would just need your Code access through FTP or CPanel and we should be done in an hour or two.
Thanks
$30 USD in 1 day
4.9 (63 reviews)
5.7
5.7
3 freelancers are bidding on average $23 USD for this job
Dear sir, I will complete your project asap, LIFETIME error free guarantee and provide ONE YEAR support... I have gone through your outsourced requirement "Create a shortcode on a Wordpress plugin (WC Vendors)" and have analysed that I have right credentials (MySQL, PHP, Web Hosting, Wordpress) to execute your esteemed project. You will never go wrong choosing me :)
Hi,
I am a Web Designer and Developer with more than 7 year experience. I have worked as Web Design & concept Consultant. I do care for concept, typo, Fonts, color culture, neatness and User friendliness presentation of the Designs.
My work Standard includes: W3C Valid XHTML/HTML/HTML5 Transitional Table-less CSS markup, W3C Valid and optimized CSS 3, effective jQuery/JavaScript Compatible with IE, Firefox, Opera, Chrome, Safari and all mobile device such as tablets iPad, Android Tablet, BlackBerry Playbook and others.
I have completely understand your requirement and I am sure that I have complete with best quality with your satisfaction. Let's initiate the PMB so we can discuss on different approach and provide you best solution in minimum time frame. Looking Forward work with you.
Regards,
WEB RSS