function post_grid_layout_add_elements() { $item_key = $_POST['item_key']; $layout = $_POST['layout']; $unique_id = $_POST['unique_id']; $class_post_grid_functions = new class_post_grid_functions(); $layout_items = $class_post_grid_functions->layout_items(); $html = array(); $html['item'] = ''; $html['item'] .= '<div class="item ' . $item_key . '" >'; if ($item_key == 'thumb') { $html['item'] .= '<img style="width:100%;" src="' . post_grid_plugin_url . 'assets/admin/images/thumb.png" />'; } elseif ($item_key == 'thumb_link') { $html['item'] .= '<a href="#"><img style="width:100%;" src="' . post_grid_plugin_url . 'assets/admin/images/thumb.png" /></a>'; } elseif ($item_key == 'title') { $html['item'] .= 'Lorem Ipsum is simply'; } elseif ($item_key == 'title_link') { $html['item'] .= '<a href="#">Lorem Ipsum is simply</a>'; } elseif ($item_key == 'excerpt') { $html['item'] .= 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text'; } elseif ($item_key == 'excerpt_read_more') { $html['item'] .= 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text <a href="#">Read more</a>'; } elseif ($item_key == 'read_more') { $html['item'] .= '<a href="#">Read more</a>'; } elseif ($item_key == 'post_date') { $html['item'] .= '18/06/2015'; } elseif ($item_key == 'author') { $html['item'] .= 'PickPlugins'; } elseif ($item_key == 'categories') { $html['item'] .= '<a hidden="#">Category 1</a> <a hidden="#">Category 2</a>'; } elseif ($item_key == 'tags') { $html['item'] .= '<a hidden="#">Tags 1</a> <a hidden="#">Tags 2</a>'; } elseif ($item_key == 'comments_count') { $html['item'] .= '3 Comments'; } elseif ($item_key == 'wc_full_price') { $html['item'] .= '<del>$45</del> - <ins>$40</ins>'; } elseif ($item_key == 'wc_sale_price') { $html['item'] .= '$45'; } elseif ($item_key == 'wc_regular_price') { $html['item'] .= '$45'; } elseif ($item_key == 'wc_add_to_cart') { $html['item'] .= 'Add to Cart'; } elseif ($item_key == 'wc_rating_star') { $html['item'] .= '*****'; } elseif ($item_key == 'wc_rating_text') { $html['item'] .= '2 Reviews'; } elseif ($item_key == 'wc_categories') { $html['item'] .= '<a href="#">Category 1</a> <a href="#">Category 2</a>'; } elseif ($item_key == 'wc_tags') { $html['item'] .= '<a href="#" >Tags 1</a> <a href="#">Tags 2</a>'; } elseif ($item_key == 'meta_key') { $html['item'] .= 'Meta Key'; } else { echo ''; } $html['item'] .= '</div>'; $html['options'] = ''; $html['options'] .= '<div class="items">'; $html['options'] .= '<div class="header"><span class="remove">X</span>' . $layout_items[$item_key] . '</div>'; $html['options'] .= '<div class="options">'; if ($item_key == 'meta_key') { $html['options'] .= 'Meta Key: <br /><input type="text" value="" name="post_grid_layout_content[' . $layout . '][' . $unique_id . '][field_id]" /><br /><br />'; } if ($item_key == 'title' || $item_key == 'title_link' || $item_key == 'excerpt' || $item_key == 'excerpt_read_more') { $html['options'] .= 'Character limit: <br /><input type="text" value="20" name="post_grid_layout_content[' . $layout . '][' . $unique_id . '][char_limit]" /><br /><br />'; } $html['options'] .= ' <input type="hidden" value="' . $item_key . '" name="post_grid_layout_content[' . $layout . '][' . $unique_id . '][key]" /> <input type="hidden" value="' . $layout_items[$item_key] . '" name="post_grid_layout_content[' . $layout . '][' . $unique_id . '][name]" /> CSS: <br /> <textarea class="custom_css" name="post_grid_layout_content[' . $layout . '][' . $unique_id . '][css]" item_id="' . $item_key . '" style="width:50%" spellcheck="false" autocapitalize="off" autocorrect="off">font-size:12px;display:block;padding:10px 0;</textarea>'; $html['options'] .= '</div>'; $html['options'] .= '</div>'; echo json_encode($html); die; }
$layout_content = 'flat'; } //var_dump($layout_content); $class_post_grid_functions = new class_post_grid_functions(); ?> <div class="layout-editor para-settings"> <?php ?> <div class="layout-items"> <?php $layout_items = $class_post_grid_functions->layout_items(); foreach ($layout_items as $item_key => $name) { ?> <div class="item" layout="<?php echo $layout_content; ?> " item_key="<?php echo $item_key; ?> " ><i class="fa fa-plus"></i> <?php echo $name; ?> </div> <?php } ?>