Home › Forums › Chit Chat › WPLMS customizations › Images
- This topic has 17 replies, 2 voices, and was last updated 1 year, 2 months ago by Anshuman Sahu.
-
AuthorPosts
-
September 7, 2023 at 8:25 pm #389424Joseph ThomasParticipant
1- How can I show up the features images for the courses in the MEGA MENU?
2- How Can I replace the PICSUM.com image with a custom image?
September 7, 2023 at 10:01 pm #389435Anshuman SahuKeymasteredit course and set course featured image : https://www.youtube.com/watch?v=gIxv_-15ro8
September 11, 2023 at 8:26 pm #389467Joseph ThomasParticipantThis reply has been marked as private.September 11, 2023 at 8:56 pm #389475Anshuman SahuKeymasterplease refer video : https://somup.com/c0QXoTAJR3
September 12, 2023 at 1:43 am #389476Joseph ThomasParticipantThis reply has been marked as private.September 12, 2023 at 9:54 pm #389493Anshuman SahuKeymasteradd this code in your wplms-customizer.php file in wplms customizer plugin :
add_shortcode('course_featured',array($Vibe_Define_Shortcodes,'course_featured'));
add_action('init',function(){
if(class_exists('Vibe_Define_Shortcodes')){
$init = Vibe_Define_Shortcodes::init();
remove_shortcode('course_featured',array($init,'course_featured'));
add_shortcode('course_featured','course_featured2');
}
});
function course_featured($atts,$content=null){
extract(shortcode_atts(array(
'width' => '100%',
'radius' => '5px',
'settings'=>'',
'align' =>'center'
), $atts));
$className='';
$a = explode('=',$settings);
if(!empty($a) && is_Array($a) && !empty($a[1])){
$className = $a[1];
}
$id = apply_filters('elementor_course_block_id','');
if(empty($id))
return;
$image = get_the_post_thumbnail_url($id,'big');
if(empty($image)){
$image = 'https://training.pointcomfort.com/wp-content/uploads/2023/09/default_course_avatar.png';//add your default image url here
}
$html ='<div class="course_featured '.$align.' '.$className.'" style="position:relative;">';
$html .= '<div class="'.$className.'" style="
'.(is_numeric($width)?'width:'.$width.'px;':$width).';
border-radius:'.(is_numeric($radius)?$radius.'px':$radius).'" ><img src="'.$image.'" /></div>';
$html .= '</div>';
return $html;
}
September 12, 2023 at 9:57 pm #389496Anshuman SahuKeymasterafter adding the code please add a default course image in your media library from wp-admin -> media .
upload an image exatly named as " default_course_image.png "
download the plugin here : https://wplms.io/support/wp-content/uploads/2023/08/wplms-customizer.zip
September 13, 2023 at 2:23 am #389509Joseph ThomasParticipantThis reply has been marked as private.September 13, 2023 at 9:00 pm #389523Anshuman SahuKeymasterthere is little mistake on code :
add this code in your wplms-customizer.php file in wplms customizer plugin :
add_shortcode('course_featured',array($Vibe_Define_Shortcodes,'course_featured'));
add_action('init',function(){
if(class_exists('Vibe_Define_Shortcodes')){
$init = Vibe_Define_Shortcodes::init();
remove_shortcode('course_featured',array($init,'course_featured'));
add_shortcode('course_featured','course_featured2');
}
});
function course_featured2($atts,$content=null){
extract(shortcode_atts(array(
'width' => '100%',
'radius' => '5px',
'settings'=>'',
'align' =>'center'
), $atts));
$className='';
$a = explode('=',$settings);
if(!empty($a) && is_Array($a) && !empty($a[1])){
$className = $a[1];
}
$id = apply_filters('elementor_course_block_id','');
if(empty($id))
return;
$image = get_the_post_thumbnail_url($id,'big');
if(empty($image)){
$image = 'https://training.pointcomfort.com/wp-content/uploads/2023/09/default_course_avatar.png';//add your default image url here
}
$html ='<div class="course_featured '.$align.' '.$className.'" style="position:relative;">';
$html .= '<div class="'.$className.'" style="
'.(is_numeric($width)?'width:'.$width.'px;':$width).';
border-radius:'.(is_numeric($radius)?$radius.'px':$radius).'" ><img src="'.$image.'" /></div>';
$html .= '</div>';
return $html;
}
September 13, 2023 at 9:14 pm #389533Joseph ThomasParticipantThis reply has been marked as private.September 15, 2023 at 7:53 pm #389576Anshuman SahuKeymasterHi I would need ftp credentials in private reply in order to add the code in your site since adding it from plugins editor is not working :
BTW this is the correct and test code :
add_action('init',function(){
if(class_exists('Vibe_Define_Shortcodes')){
$init = Vibe_Define_Shortcodes::init();
remove_shortcode('course_featured',array($init,'course_featured'));
add_shortcode('course_featured','course_featured2');
}
});
function course_featured2($atts,$content=null){
extract(shortcode_atts(array(
'width' => '100%',
'radius' => '5px',
'settings'=>'',
'align' =>'center'
), $atts));
$className='';
$a = explode('=',$settings);
if(!empty($a) && is_Array($a) && !empty($a[1])){
$className = $a[1];
}
$id = apply_filters('elementor_course_block_id','');
if(empty($id))
return;
$image = get_the_post_thumbnail_url($id,'big');
if(empty($image)){
$image = 'https://training.pointcomfort.com/wp-content/uploads/2023/09/default_course_avatar.png';//add your default image url here
}
$html ='<div class="course_featured '.$align.' '.$className.'" style="position:relative;">';
$html .= '<div class="'.$className.'" style="
'.(is_numeric($width)?'width:'.$width.'px;':$width).';
border-radius:'.(is_numeric($radius)?$radius.'px':$radius).'" ><img src="'.$image.'" /></div>';
$html .= '</div>';
return $html;
}
September 15, 2023 at 9:36 pm #389603Joseph ThomasParticipantThis reply has been marked as private.September 16, 2023 at 8:03 pm #389616Anshuman SahuKeymasterYou are right this code is not working anymore with latest version of wplms plugn , please remove that code.
add this code in your wplms-customizer.php file in wplms customizer plugin :
add_shortcode('course_featured2','course_featured2');
function course_featured2($atts,$content=null){
extract(shortcode_atts(array(
'width' => '100%',
'radius' => '5px',
'settings'=>'',
'align' =>'center'
), $atts));
$className='';
$a = explode('=',$settings);
if(!empty($a) && is_Array($a) && !empty($a[1])){
$className = $a[1];
}
$id = apply_filters('elementor_course_block_id','');
if(empty($id))
return;
$image = get_the_post_thumbnail_url($id,'big');
if(empty($image)){
$image = 'https://training.pointcomfort.com/wp-content/uploads/2023/09/default_course_avatar.png';//add your default image url here
}
$html ='<div class="course_featured '.$align.' '.$className.'" style="position:relative;">';
$html .= '<div class="'.$className.'" style="
'.(is_numeric($width)?'width:'.$width.'px;':$width).';
border-radius:'.(is_numeric($radius)?$radius.'px':$radius).'" ><img src="'.$image.'" /></div>';
$html .= '</div>';
return $html;
}
after this please goto wp-admin - vibebp-> course card => edit the topmost course card in elementor and in place of course featured block please add this shortcode :
[course_featured2 width="100%"]
-
AuthorPosts
- You must be logged in to reply to this topic.