Can’t find a way for new module to be working
-
On page builder there are a few modules which our not meeting my needs. I am wanting to create some other modules by extending your ‘AMP Theme Framework’ I have create a file there name mytheme-feature-module and include it with this function following your moduleTemplate.php file
add_action("plugins_loaded", "mytheme_amp_module_templates",50); if(!function_exists("mytheme_amp_module_templates")){ function mytheme_amp_module_templates(){ global $moduleTemplate; $dir = plugin_dir_path(__FILE__) . 'modules/'; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if(is_file($dir.$file) && strpos($file, '-module.php') == true){ $moduleTemplate[str_replace("-module.php", "", $file)] = include $dir.$file; //echo '<pre>'; print_r($mmoduleTemplate[str_replace("-module.php", "", $file)]); exit; } } closedir($dh); $moduleTemplate = apply_filters("ampforwp_pagebuilder_modules_filter", $moduleTemplate); } } } }
And here is the feture file’s code I have created on modules folder
<?php $output = ' <div class="ln-fx">{{repeater}}</div>'; $css = '.service { margin-bottom: 30px; } .service .service-icon { width: 130px; margin: 0 auto 20px; } .service h3 { font-size: 2.2rem; color: #16334e; font-weight: 700; font-family: "Nunito", sans-serif; margin-bottom: 18px; -webkit-transition: all .3s easa; transition: all .3s easa; } .service:hover h3 { color: #0083ff; }'; return array( 'label' => 'Mytheme Feature', 'name' => 'mytheme-feature-mod', 'default_tab' => 'customizer', 'tabs' => array( 'customizer' => 'Content', 'design' => 'Design', 'advanced' => 'Advanced', ), 'fields' => array( array( 'type' => 'checkbox', 'name' => "image_layout", 'tab' => 'customizer', 'label' => 'Image Type', 'default' => array('layout="responsive"'), 'options' => array( array( 'label' => 'Responsive', 'value' => 'layout="responsive"', ), ), 'content_type' => 'html' ), array( 'type' => 'text', 'name' => 'img_width', 'label' => 'Image Size', 'tab' => 'customizer', 'default' => '300px', 'content_type' => 'css' ), ), 'front_template' => $output, 'front_css' => $css, 'front_common_css' => '', 'repeater' => array( 'tab' => 'customizer', 'fields' => array( array( 'type' => 'text', 'name' => "content_title", 'label' => 'Heading', 'tab' => 'customizer', 'default' => 'Your Feature Title', 'content_type' => 'html' ), array( 'type' => 'upload', 'name' => "img_upload", 'label' => 'Image', 'tab' => 'customizer', 'default' => '', 'content_type' => 'html' ), array( 'type' => 'text-editor', 'name' => "content", 'label' => 'Content', 'tab' => 'customizer', 'default' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut.', 'content_type' => 'html' ), ), 'front_template' => '<div class="service text-center"> {{if_img_upload}}<div class="service-icon"><amp-img src="{{img_upload}}" width="{{image_width}}" height="{{image_height}}" {{image_layout}} alt="{{image_alt}}"></amp-img></div>{{ifend_img_upload}} <h3 class="service-title">{{content_title}}</h3> <p>{{content}}</p> </div>' ), ); ?>
These are all I have done while trying to make a new module, It’s now listed on the available modules list on AMP Page Builder but when I add, It’s not including anything on the front-end. Your modules are perfectly working but it’s not working on front-end. Am I missing anything or doing something wrong?
- The topic ‘Can’t find a way for new module to be working’ is closed to new replies.