Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › Add custom fields with different icons in right sidebar
Tagged: custom field, custom icons, rigt sidebar
- This topic has 8 replies, 2 voices, and was last updated 7 years, 2 months ago by educat.
Viewing 9 posts - 1 through 9 (of 9 total)
-
AuthorPosts
-
August 31, 2017 at 7:06 pm #127354educatParticipantHi, 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 advanceSeptember 1, 2017 at 5:07 am #127397H.K. LatiyanParticipantHi, 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/gfoaspSeptember 1, 2017 at 11:32 am #127480educatParticipantYes, but there is no option to choose the iconSeptember 1, 2017 at 11:46 am #127484educatParticipantIt 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; }September 1, 2017 at 12:00 pm #127489educatParticipantThis reply has been marked as private.September 2, 2017 at 6:27 am #127580H.K. LatiyanParticipantHi, 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.September 4, 2017 at 11:51 am #127714educatParticipantYes, 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.September 5, 2017 at 6:04 am #127769H.K. LatiyanParticipantHi, 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/gh84aoSeptember 8, 2017 at 12:03 pm #128309educatParticipantThat worked, thanks a lot! -
AuthorPosts
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.