THIS THREAD HAS BEEN CLOSED.

[tut] Limit number porfolio

Updated on Aug 25, 2016 in FreelanceEngine
0 on Aug 13, 2016

Currently, Freelancer account can free upload many portfolios in their profile. Add this code into child-theme/functions.php to limit the number portfolios can be upload is 2.

add_filter('ae_pre_insert_portfolio', 'cs_check_before_add_porfolio' );
function cs_check_before_add_porfolio($args){
global $user_ID;
$posts = get_posts( array( 'post_type' => 'portfolio', 'author'=> $user_ID) );
$number_porfolios = count($posts);
if($number_porfolios >= 2){
return new WP_Error( 'limit_add', __('You are not allowed to add than 2 porfolios') );
}
return $args;
}

 

Tags: #limit number portfolios, limit portfolios, number portfolios, 

  • Liked by
Loading more replies
Posting & Replying function will be deactivated from 3pm GMT+7 12th Sep.
Read More