Add custom fields with different icons in right sidebar

Home Forums Legacy Support Support queries How-to & Troubleshooting Add custom fields with different icons in right sidebar

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #127354
    educat
    Participant
    Hi, I'd like to know how to add custom fields with different icons in the right sidebar in the Single Course Page: http://prntscr.com/gfipgl I already have one custom field, but the code I'm using in WPLMS Customizer doesn't support many custom fields with different icons each. It adds the same icon for all custom fields. I tried to change it a bit, but got error 500. Could you guys provide me with the proper code to do what I'm trying to do? Thanks in advance
    #127397
    H.K. Latiyan
    Participant
    Hi, Now you can directly go to wp-admin->lms->settings->course settings, and then you can add or remove any field from there, refer: http://prntscr.com/gfoasp
    #127480
    educat
    Participant
    Yes, but there is no option to choose the icon
    #127484
    educat
    Participant
    It doesn't work, the newly created fields appear in the course details, but I can't add a value to it through the edit course page, cause it's not there. I want to display something like this: Anticipated Subscription   - discount value And I need to be able to add specific discounts for each course. The code I'm using - I got it from this forum - allows me to do something similar, but it's a one time thing. I need to add many fields to course details. This is a custom field I have, it looks like this in the edit course page: http://prntscr.com/gfsb7g It is displayed like this in Course Details: http://prntscr.com/gfskwy This is the custom code I'm using:
    /* Adicionar campo Carga Horária */ add_filter('wplms_course_metabox','wplms_custom_course_details_repeatable'); function wplms_custom_course_details_repeatable($metabox){ $metabox['vibe_course_details'] = array( 'label' => __('Carga Horária','vibe-customtypes'), // <label> 'desc'  => __('Duração do curso.','vibe-customtypes'), // description 'id'    => 'vibe_course_details', // field id and name 'type'  => 'repeatable', // type of field 'std'   => '' ); return $metabox; }   /* Exibir campo Carga Horária em Course Details RightSidebar */ add_filter('wplms_course_details_widget','wplms_custom_course_details_information',99999999); function wplms_custom_course_details_information($details){ $custom_info = vibe_sanitize(get_post_meta(get_the_ID(),'vibe_course_details',false)); if(isset($custom_info) && is_array($custom_info)){ foreach($custom_info as $k=>$val){ $details[]='
  • <i class="icon-clock"></i>'.htmlspecialchars_decode($val).'
  • '; } } return $details; }
    #127489
    educat
    Participant
    This reply has been marked as private.
    #127580
    H.K. Latiyan
    Participant
    Hi, The icon which is now shown here is of a clock which is set due to the class on it, refer: http://prntscr.com/gg3pbp For different custom details section we do not have different icon options as of now. This is only present in the logged in menu (lms->settings->logged in menu). In the code if you change the class to a different than the clock then a different icon will appear but it will be for all the custom details you add. Make sure you can only use fontawesome icons in wplms: http://fontawesome.io/icons/ For different icons for custom details please create a feature request in our feature request forum and we'll add it in the lms->settings->course settings.  
    #127714
    educat
    Participant
    Yes, man, I understand that. But the main issue is not that. The code above adds one field. If you copy paste the code and change field ID to add another field, it will give you a 500 Server Error. Is there no solution to this? I need to add much more than just one field.
    #127769
    H.K. Latiyan
    Participant
    Hi, If you are adding the code twice then yes it will give you 500 error because the function name is same. In php no two functions can have the same name, so if you want to use this code twice then change the function name, refer: http://prntscr.com/gh84ao
    #128309
    educat
    Participant
    That worked, thanks a lot!
Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Add custom fields with different icons in right sidebar’ is closed to new replies.