Skip to content

Instantly share code, notes, and snippets.

@tripflex
Last active November 4, 2018 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/0cf3379bea01b645dc8e653a0f6f3149 to your computer and use it in GitHub Desktop.
Save tripflex/0cf3379bea01b645dc8e653a0f6f3149 to your computer and use it in GitHub Desktop.
WP Job Manager WooCommerce Paid Listings My Packages Shortcode
<?php
add_shortcode( 'wcpl_my_packages', 'smyles_output_wcpl_my_packages' );
function smyles_output_wcpl_my_packages() {
// Make sure WCPL plugin is installed and activated
if( ! function_exists( 'wc_paid_listings_get_user_packages' ) || ! defined( 'JOB_MANAGER_WCPL_TEMPLATE_PATH' ) ){
return '';
}
$user_id = get_current_user_id();
// User not logged in, don't output anything
if( empty( $user_id ) ){
return '';
}
ob_start();
if ( ( $packages = wc_paid_listings_get_user_packages( $user_id, 'job_listing' ) ) && is_array( $packages ) && sizeof( $packages ) > 0 ) {
wc_get_template( 'my-packages.php', array(
'packages' => $packages,
'type' => 'job_listing',
), 'wc-paid-listings/', JOB_MANAGER_WCPL_TEMPLATE_PATH );
}
if ( ( $packages = wc_paid_listings_get_user_packages( get_current_user_id(), 'resume' ) ) && is_array( $packages ) && sizeof( $packages ) > 0 ) {
wc_get_template( 'my-packages.php', array(
'packages' => $packages,
'type' => 'resume',
), 'wc-paid-listings/', JOB_MANAGER_WCPL_TEMPLATE_PATH );
}
return ob_get_clean();
}
@tripflex
Copy link
Author

tripflex commented Nov 4, 2018

This code is provided as a courtesy, I do not provide support for WooCommerce Paid Listings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment