public function post_grid_install() { $class_post_grid_functions = new class_post_grid_functions(); $post_grid_layout_content = get_option('post_grid_layout_content'); if (empty($post_grid_layout_content)) { $layout_content_list = $class_post_grid_functions->layout_content_list(); update_option('post_grid_layout_content', $layout_content_list); } //$layout_hover_list = $class_post_grid_functions->layout_hover_list(); //update_option('post_grid_layout_hover', $layout_hover_list); do_action('post_grid_action_install'); }
public function post_grid_install() { $class_post_grid_functions = new class_post_grid_functions(); $post_grid_layout_content = get_option('post_grid_layout_content'); if (empty($post_grid_layout_content)) { $layout_content_list = $class_post_grid_functions->layout_content_list(); update_option('post_grid_layout_content', $layout_content_list); } if (!file_exists(ABSPATH . "wp-content/uploads/post-grid/")) { mkdir(ABSPATH . "wp-content/uploads/post-grid/"); } do_action('post_grid_action_install'); }
public function post_grid_display($atts, $content = null) { $atts = shortcode_atts(array('id' => ""), $atts); $html = ''; $post_id = $atts['id']; $post_grid_themes = get_post_meta($post_id, 'post_grid_themes', true); $post_grid_license_key = get_option('post_grid_license_key'); if (empty($post_grid_license_key)) { return '<b>"' . post_grid_plugin_name . '" Error:</b> Please activate your license.'; } $class_post_grid_functions = new class_post_grid_functions(); $post_grid_themes_dir = $class_post_grid_functions->post_grid_themes_dir(); $post_grid_themes_url = $class_post_grid_functions->post_grid_themes_url(); //var_dump($post_grid_themes_url); $html .= '<link type="text/css" media="all" rel="stylesheet" href="' . $post_grid_themes_url[$post_grid_themes] . '/style.css" >'; include $post_grid_themes_dir[$post_grid_themes] . '/index.php'; return $html; }
function meta_boxes_post_grid_input($post) { global $post; wp_nonce_field('meta_boxes_post_grid_input', 'meta_boxes_post_grid_input_nonce'); $post_grid_meta_options = get_post_meta($post->ID, 'post_grid_meta_options', true); if (!empty($post_grid_meta_options['post_types'])) { $post_types = $post_grid_meta_options['post_types']; } else { $post_types = array('post'); } if (!empty($post_grid_meta_options['post_status'])) { $post_status = $post_grid_meta_options['post_status']; } else { $post_status = array('publish'); } if (!empty($post_grid_meta_options['posts_per_page'])) { $posts_per_page = $post_grid_meta_options['posts_per_page']; } else { $posts_per_page = 10; } if (!empty($post_grid_meta_options['exclude_post_id'])) { $exclude_post_id = $post_grid_meta_options['exclude_post_id']; } if (!empty($post_grid_meta_options['query_order'])) { $query_order = $post_grid_meta_options['query_order']; } else { $query_order = 'DESC'; } if (!empty($post_grid_meta_options['query_orderby'])) { $query_orderby = $post_grid_meta_options['query_orderby']; } else { $query_orderby = array('date'); } if (!empty($post_grid_meta_options['keyword'])) { $keyword = $post_grid_meta_options['keyword']; } if (!empty($post_grid_meta_options['layout']['content'])) { $layout_content = $post_grid_meta_options['layout']['content']; } else { $layout_content = 'flat'; } if (!empty($post_grid_meta_options['layout']['hover'])) { $layout_hover = $post_grid_meta_options['layout']['hover']; } if (!empty($post_grid_meta_options['skin'])) { $skin = $post_grid_meta_options['skin']; } else { $skin = 'flat'; } if (!empty($post_grid_meta_options['custom_js'])) { $custom_js = $post_grid_meta_options['custom_js']; } else { $custom_js = '/*Write your js code here*/'; } if (!empty($post_grid_meta_options['custom_css'])) { $custom_css = $post_grid_meta_options['custom_css']; } else { $custom_css = '/*Write your CSS code here*/'; } if (!empty($post_grid_meta_options['width']['desktop'])) { $items_width_desktop = $post_grid_meta_options['width']['desktop']; } else { $items_width_desktop = '280px'; } if (!empty($post_grid_meta_options['width']['tablet'])) { $items_width_tablet = $post_grid_meta_options['width']['tablet']; } else { $items_width_tablet = '280px'; } if (!empty($post_grid_meta_options['width']['mobile'])) { $items_width_mobile = $post_grid_meta_options['width']['mobile']; } else { $items_width_mobile = '90%'; } if (!empty($post_grid_meta_options['height']['style'])) { $items_height_style = $post_grid_meta_options['height']['style']; } else { $items_height_style = 'auto_height'; } if (!empty($post_grid_meta_options['height']['fixed_height'])) { $items_fixed_height = $post_grid_meta_options['height']['fixed_height']; } else { $items_fixed_height = '180px'; } if (!empty($post_grid_meta_options['media_source'])) { $media_source = $post_grid_meta_options['media_source']; } else { $media_source = array(); } if (!empty($post_grid_meta_options['featured_img_size'])) { $featured_img_size = $post_grid_meta_options['featured_img_size']; } else { $featured_img_size = 'medium'; } if (!empty($post_grid_meta_options['margin'])) { $items_margin = $post_grid_meta_options['margin']; } else { $items_margin = '10px'; } if (!empty($post_grid_meta_options['container']['padding'])) { $container_padding = $post_grid_meta_options['container']['padding']; } else { $container_padding = '10px'; } if (!empty($post_grid_meta_options['container']['bg_color'])) { $container_bg_color = $post_grid_meta_options['container']['bg_color']; } else { $container_bg_color = '#fff'; } if (!empty($post_grid_meta_options['container']['bg_image'])) { $container_bg_image = $post_grid_meta_options['container']['bg_image']; } else { $container_bg_image = ''; } if (!empty($post_grid_meta_options['nav_bottom']['pagination_type'])) { $pagination_type = $post_grid_meta_options['nav_bottom']['pagination_type']; } else { $pagination_type = 'none'; } if (!empty($post_grid_meta_options['nav_bottom']['pagination_theme'])) { $pagination_theme = $post_grid_meta_options['nav_bottom']['pagination_theme']; } else { $pagination_theme = 'lite'; } ?> <div class="para-settings post-grid-metabox"> <ul class="tab-nav"> <li nav="1" class="nav1 active"><i class="fa fa-code"></i> <?php _e('Shortcodes', 'post_grid'); ?> </li> <li nav="2" class="nav2"><i class="fa fa-cubes"></i> <?php _e('Query Post', 'post_grid'); ?> </li> <li nav="3" class="nav3"><i class="fa fa-object-group"></i> <?php _e('Layout', 'post_grid'); ?> </li> <li nav="4" class="nav3"><i class="fa fa-magic"></i> <?php _e('Layout settings', 'post_grid'); ?> </li> <li nav="5" class="nav4"><i class="fa fa-sliders"></i> <?php _e('Navigations', 'post_grid'); ?> </li> <li nav="6" class="nav6"><i class="fa fa-css3"></i> <?php _e('Custom Scripts', 'post_grid'); ?> </li> </ul> <!-- tab-nav end --> <ul class="box"> <li style="display: block;" class="box1 tab-box active"> <div class="option-box"> <p class="option-title"><?php _e('Shortcode', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Copy this shortcode and paste on page or post where you want to display post grid. <br />Use PHP code to your themes file to display post grid.', 'post_grid'); ?> </p> <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" >[post_grid <?php echo 'id="' . $post->ID . '"'; ?> ]</textarea> <br /><br /> PHP Code:<br /> <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[post_grid id='; echo "'" . $post->ID . "']"; echo '"); ?>'; ?> </textarea> </div> </li> <li style="display: none;" class="box2 tab-box "> <div class="option-box"> <p class="option-title"><?php _e('Post Types', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Select post types you want to query post , can be select multiple. <br />Hint: Ctrl + click to select mulitple', 'post_grid'); ?> </p> <?php echo post_grid_posttypes($post_types); ?> </div> <div class="option-box"> <p class="option-title"><?php _e('Post Status', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Display post from following post status, <br />Hint: Ctrl + click to select mulitple', 'post_grid'); ?> </p> <select class="post_status" name="post_grid_meta_options[post_status][]" multiple > <option value="publish" <?php if (in_array("publish", $post_status)) { echo "selected"; } ?> >Publish</option> <option value="pending" <?php if (in_array("pending", $post_status)) { echo "selected"; } ?> >Pending</option> <option value="draft" <?php if (in_array("draft", $post_status)) { echo "selected"; } ?> >Draft</option> <option value="auto-draft" <?php if (in_array("auto-draft", $post_status)) { echo "selected"; } ?> >Auto draft</option> <option value="future" <?php if (in_array("future", $post_status)) { echo "selected"; } ?> >Future</option> <option value="private" <?php if (in_array("private", $post_status)) { echo "selected"; } ?> >Private</option> <option value="inherit" <?php if (in_array("inherit", $post_status)) { echo "selected"; } ?> >Inherit</option> <option value="trash" <?php if (in_array("trash", $post_status)) { echo "selected"; } ?> >Trash</option> <option value="any" <?php if (in_array("any", $post_status)) { echo "selected"; } ?> >Any</option> </select> </div> <div class="option-box"> <p class="option-title"><?php _e('Posts per page', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Number of post each pagination. -1 to display all. default is 10 if you left empty.', 'post_grid'); ?> </p> <input type="text" placeholder="3" name="post_grid_meta_options[posts_per_page]" value="<?php if (!empty($posts_per_page)) { echo $posts_per_page; } else { echo ''; } ?> " /> </div> <div class="option-box"> <p class="option-title"><?php _e('Exclude by post ID', 'post_grid'); ?> </p> <p class="option-info"><?php _e('you can exclude post by ID, comma(,) separated', 'post_grid'); ?> </p> <input type="text" placeholder="5,3" name="post_grid_meta_options[exclude_post_id]" value="<?php if (!empty($exclude_post_id)) { echo $exclude_post_id; } else { echo ''; } ?> " /> </div> <div class="option-box"> <p class="option-title"><?php _e('Post query order', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Query order ascending or descending', 'post_grid'); ?> </p> <select class="query_order" name="post_grid_meta_options[query_order]" > <option value="ASC" <?php if ($query_order == "ASC") { echo "selected"; } ?> >Ascending</option> <option value="DESC" <?php if ($query_order == "DESC") { echo "selected"; } ?> >Descending</option> </select> </div> <div class="option-box"> <p class="option-title"><?php _e('Post query orderby', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Query orderby parameter, can select multiple', 'post_grid'); ?> </p> <select class="query_orderby" name="post_grid_meta_options[query_orderby][]" multiple> <option value="ID" <?php if (in_array("ID", $query_orderby)) { echo "selected"; } ?> >ID</option> <option value="date" <?php if (in_array("date", $query_orderby)) { echo "selected"; } ?> >Date</option> <option value="rand" <?php if (in_array("rand", $query_orderby)) { echo "selected"; } ?> >Rand</option> <option value="comment_count" <?php if (in_array("comment_count", $query_orderby)) { echo "selected"; } ?> >Comment Count</option> <option value="author" <?php if (in_array("author", $query_orderby)) { echo "selected"; } ?> >Author</option> <option value="title" <?php if (in_array("title", $query_orderby)) { echo "selected"; } ?> >Title</option> <option value="name" <?php if (in_array("name", $query_orderby)) { echo "selected"; } ?> >Name</option> <option value="type" <?php if (in_array("type", $query_orderby)) { echo "selected"; } ?> >Type</option> </select> <br /> </div> <div class="option-box"> <p class="option-title"><?php _e('Search keyword', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Query post by search keyword, please follow the reference https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter', 'post_grid'); ?> </p> <input type="text" placeholder="Keyword" name="post_grid_meta_options[keyword]" value="<?php if (!empty($keyword)) { echo $keyword; } else { echo ''; } ?> " /> </div> </li> <li style="display: none;" class="box3 tab-box "> <div class="option-box"> <p class="option-title"><?php _e('Layout', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Choose your layout', 'post_grid'); ?> </p> <?php $class_post_grid_functions = new class_post_grid_functions(); ?> <div class="layout-list"> <div class="idle "> <div class="name">Content <select class="select-layout-content" name="post_grid_meta_options[layout][content]" > <?php $layout_content_list = $class_post_grid_functions->layout_content_list(); foreach ($layout_content_list as $layout_key => $layout_info) { ?> <option <?php if ($layout_content == $layout_key) { echo 'selected'; } ?> value="<?php echo $layout_key; ?> "><?php echo $layout_key; ?> </option> <?php } ?> </select> <a target="_blank" class="edit-layout" href="<?php echo admin_url() . 'edit.php?post_type=post_grid&page=post_grid_layout_editor&layout_content=' . $layout_content; ?> " >Edit</a> </div> <script> jQuery(document).ready(function($) { $(document).on('change', '.select-layout-content', function() { var layout = $(this).val(); $('.edit-layout').attr('href', '<?php echo admin_url() . 'edit.php?post_type=post_grid&page=post_grid_layout_editor&layout_content='; ?> '+layout); }) }) </script> <?php if (empty($layout_content)) { $layout_content = 'flat-left'; } ?> <div class="layer-content"> <div class="<?php echo $layout_content; ?> "> <?php $post_grid_layout_content = get_option('post_grid_layout_content'); if (empty($post_grid_layout_content)) { $layout = $class_post_grid_functions->layout_content($layout_content); } else { $layout = $post_grid_layout_content[$layout_content]; } // $layout = $class_post_grid_functions->layout_content($layout_content); //var_dump($layout); foreach ($layout as $item_key => $item_info) { $item_key = $item_info['key']; ?> <div class="item <?php echo $item_key; ?> " style=" <?php echo $item_info['css']; ?> "> <?php if ($item_key == 'thumb') { ?> <img style="width:100%; height:auto;" src="<?php echo post_grid_plugin_url; ?> assets/admin/images/thumb.png" /> <?php } elseif ($item_key == 'title') { ?> Lorem Ipsum is simply <?php } elseif ($item_key == 'excerpt') { ?> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text <?php } else { echo $item_info['name']; } ?> </div> <?php } ?> </div> </div> </div> <div class="hover"> <div class="name"> <select class="select-layout-hover" name="post_grid_meta_options[layout][hover]" > <?php $layout_hover_list = $class_post_grid_functions->layout_hover_list(); foreach ($layout_hover_list as $layout_key => $layout_info) { ?> <option value="<?php echo $layout_key; ?> "><?php echo $layout_key; ?> </option> <?php } ?> </select> Hover</div> <div class="layer-hover"> <div class="title">Hello Title</div> <div class="content">There are many variations of passages of Lorem Ipsum available, but the majority have.</div> </div> </div> </div> </div> <div class="option-box"> <p class="option-title"><?php _e('Skins', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Select grid Skins', 'post_grid'); ?> </p> <?php $skins = $class_post_grid_functions->skins(); ?> <div class="skin-list"> <?php //var_dump($skin); foreach ($skins as $skin_slug => $skin_info) { ?> <div class="skin-container"> <?php if ($skin == $skin_slug) { $checked = 'checked'; $selected_skin = 'selected'; } else { $checked = ''; $selected_skin = ''; } ?> <div class="checked <?php echo $selected_skin; ?> "> <label><input <?php echo $checked; ?> type="radio" name="post_grid_meta_options[skin]" value="<?php echo $skin_slug; ?> " ><?php echo $skin_info['name']; ?> </label> </div> <div class="skin <?php echo $skin_slug; ?> "> <?php include post_grid_plugin_dir . 'skins/' . $skin_slug . '/index.php'; ?> </div> </div> <?php } ?> </div> </div> </li> <li style="display: none;" class="box4 tab-box "> <div class="option-box"> <p class="option-title"><?php _e('Grid Items Width', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Grid item width for different device', 'post_grid'); ?> </p> <div class=""> Desktop:(min-width:1024px)<br> <input type="text" name="post_grid_meta_options[width][desktop]" value="<?php echo $items_width_desktop; ?> " /> </div> <br> <div class=""> Tablet:( min-width:768px )<br> <input type="text" name="post_grid_meta_options[width][tablet]" value="<?php echo $items_width_tablet; ?> " /> </div> <br> <div class=""> Mobile:( min-width : 320px, )<br> <input type="text" name="post_grid_meta_options[width][mobile]" value="<?php echo $items_width_mobile; ?> " /> </div> </div> <div class="option-box"> <p class="option-title"><?php _e('Media Height', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Grid item media height', 'post_grid'); ?> </p> <label><input <?php if ($items_height_style == 'auto_height') { echo 'checked'; } ?> type="radio" name="post_grid_meta_options[height][style]" value="auto_height" />Auto height</label><br /> <label><input <?php if ($items_height_style == 'fixed_height') { echo 'checked'; } ?> type="radio" name="post_grid_meta_options[height][style]" value="fixed_height" />Fixed height</label><br /> <div class=""> <input type="text" name="post_grid_meta_options[height][fixed_height]" value="<?php echo $items_fixed_height; ?> " /> </div> </div> <div class="option-box"> <p class="option-title"><?php _e('Featured Image size', 'post_grid'); ?> </p> <select name="post_grid_meta_options[featured_img_size]" > <option value="full" <?php if ($featured_img_size == "full") { echo "selected"; } ?> ><?php _e('Full', 'post_grid'); ?> </option> <option value="thumbnail" <?php if ($featured_img_size == "thumbnail") { echo "selected"; } ?> ><?php _e('Thumbnail', 'post_grid'); ?> </option> <option value="medium" <?php if ($featured_img_size == "medium") { echo "selected"; } ?> ><?php _e('Medium', 'post_grid'); ?> </option> <option value="large" <?php if ($featured_img_size == "large") { echo "selected"; } ?> ><?php _e('Large', 'post_grid'); ?> </option> </select> <p class="option-title"><?php _e('Media source', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Grid item media source', 'post_grid'); ?> </p> <?php if (empty($media_source)) { $media_source = $class_post_grid_functions->media_source(); } ?> <div class="media-source-list expandable"> <?php foreach ($media_source as $source_key => $source_info) { ?> <div class="items"> <div class="header"> <input type="hidden" name="post_grid_meta_options[media_source][<?php echo $source_info['id']; ?> ][id]" value="<?php echo $source_info['id']; ?> " /> <input type="hidden" name="post_grid_meta_options[media_source][<?php echo $source_info['id']; ?> ][title]" value="<?php echo $source_info['title']; ?> " /> <input <?php if (!empty($source_info['checked'])) { echo 'checked'; } ?> type="checkbox" name="post_grid_meta_options[media_source][<?php echo $source_info['id']; ?> ][checked]" value="<?php echo $source_info['checked']; ?> " /> <?php echo $source_info['title']; ?> </div> </div> <?php } ?> </div> <script> jQuery(document).ready(function($) { $( ".media-source-list" ).sortable({revert: "invalid"}); }) </script> </div> <div class="option-box"> <p class="option-title"><?php _e('Grid Items Margin', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Grid item margin', 'post_grid'); ?> </p> <div class=""> <input type="text" name="post_grid_meta_options[margin]" value="<?php echo $items_margin; ?> " /> </div> </div> <div class="option-box"> <p class="option-title"><?php _e('Grid Container options', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Grid container ', 'post_grid'); ?> </p> <div class=""> Padding: <br> <input type="text" name="post_grid_meta_options[container][padding]" value="<?php echo $container_padding; ?> " /> </div> <br> <div class=""> Background color: <br> <input type="text" class="color" name="post_grid_meta_options[container][bg_color]" value="<?php echo $container_bg_color; ?> " /> </div> <br> <div class=""> Background image: <br> <img class="bg_image_src" onClick="bg_img_src(this)" src="<?php echo post_grid_plugin_url; ?> assets/admin/bg/dark_embroidery.png" /> <img class="bg_image_src" onClick="bg_img_src(this)" src="<?php echo post_grid_plugin_url; ?> assets/admin/bg/dimension.png" /> <img class="bg_image_src" onClick="bg_img_src(this)" src="<?php echo post_grid_plugin_url; ?> assets/admin/bg/eight_horns.png" /> <br> <input type="text" id="container_bg_image" class="container_bg_image" name="post_grid_meta_options[container][bg_image]" value="<?php echo $container_bg_image; ?> " /> <div onClick="clear_container_bg_image()" class="button clear-container-bg-image"> Clear</div> <script> function bg_img_src(img){ src =img.src; document.getElementById('container_bg_image').value = src; } function clear_container_bg_image(){ document.getElementById('container_bg_image').value = ''; } </script> </div> </div> </li> <li style="display: none;" class="box5 tab-box "> <div class="option-box"> <p class="option-title"><?php _e('Navigation', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Customize navigation layout.', 'post_grid'); ?> </p> <div class="grid-layout"> <div class="grid-up"> Premium Features </div> <div class="grid-container"> <img src="<?php echo post_grid_plugin_url; ?> assets/admin/images/grid.png" /> </div> <div class="grid-bottom"> <label><input <?php if ($pagination_type == 'none') { echo 'checked'; } ?> type="radio" name="post_grid_meta_options[nav_bottom][pagination_type]" value="none" />None</label> <label><input <?php if ($pagination_type == 'pagination') { echo 'checked'; } ?> type="radio" name="post_grid_meta_options[nav_bottom][pagination_type]" value="pagination" />Pagination</label> </div> </div> </div> <div class="option-box"> <p class="option-title"><?php _e('Pagination themes', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Themes for pagination', 'post_grid'); ?> </p> <label><input <?php if ($pagination_theme == 'lite') { echo 'checked'; } ?> type="radio" name="post_grid_meta_options[nav_bottom][pagination_theme]" value="lite" />Lite</label> <label><input <?php if ($pagination_theme == 'dark') { echo 'checked'; } ?> type="radio" name="post_grid_meta_options[nav_bottom][pagination_theme]" value="dark" />Dark</label> </div> </li> <li style="display: none;" class="box6 tab-box "> <div class="option-box"> <p class="option-title"><?php _e('Custom Js', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Add your custom js', 'post_grid'); ?> </p> <textarea id="custom_js" name="post_grid_meta_options[custom_js]" ><?php echo $custom_js; ?> </textarea> </div> <div class="option-box"> <p class="option-title"><?php _e('Custom CSS', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Add your custom CSS', 'post_grid'); ?> </p> <textarea id="custom_css" name="post_grid_meta_options[custom_css]" ><?php echo $custom_css; ?> </textarea> </div> <script> var editor = CodeMirror.fromTextArea(document.getElementById("custom_js"), { lineNumbers: true, scrollbarStyle: "simple" }); var editor = CodeMirror.fromTextArea(document.getElementById("custom_css"), { lineNumbers: true, scrollbarStyle: "simple" }); </script> </li> </ul> </div> <?php }
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; }
<?php /* * @Author pickplugins * Copyright: 2015 pickplugins.com */ if (!defined('ABSPATH')) { exit; } // if direct access $class_post_grid_functions = new class_post_grid_functions(); $post_grid_layout_content = get_option('post_grid_layout_content'); if (empty($post_grid_layout_content)) { $layout = $class_post_grid_functions->layout_content($layout_content); } else { $layout = $post_grid_layout_content[$layout_content]; } //$layout = $class_post_grid_functions->layout_content($layout_content); $html .= '<div class="layer-content">'; foreach ($layout as $item_key => $item_info) { $item_key = $item_info['key']; if (!empty($item_info['char_limit'])) { $char_limit = $item_info['char_limit']; } if ($item_key == 'title') { $html .= '<div class="element ' . $item_key . '" style="' . $item_info['css'] . '" >'; $html .= wp_trim_words(get_the_title(), $char_limit, ''); $html .= '</div>'; } elseif ($item_key == 'title_link') { $html .= '<a class="element ' . $item_key . '" style="' . $item_info['css'] . '" href="' . get_permalink() . '">' . wp_trim_words(get_the_title(), $char_limit, '') . '</a>'; } elseif ($item_key == 'thumb') {
function meta_boxes_post_grid_input($post) { global $post; wp_nonce_field('meta_boxes_post_grid_input', 'meta_boxes_post_grid_input_nonce'); $post_grid_post_per_page = get_post_meta($post->ID, 'post_grid_post_per_page', true); $post_grid_themes = get_post_meta($post->ID, 'post_grid_themes', true); $post_grid_masonry_enable = get_post_meta($post->ID, 'post_grid_masonry_enable', true); $post_grid_bg_img = get_post_meta($post->ID, 'post_grid_bg_img', true); $post_grid_thumb_size = get_post_meta($post->ID, 'post_grid_thumb_size', true); $post_grid_empty_thumb = get_post_meta($post->ID, 'post_grid_empty_thumb', true); $post_grid_pagination_display = get_post_meta($post->ID, 'post_grid_pagination_display', true); $post_grid_excerpt_count = get_post_meta($post->ID, 'post_grid_excerpt_count', true); $post_grid_read_more_text = get_post_meta($post->ID, 'post_grid_read_more_text', true); $post_grid_exclude_post_id = get_post_meta($post->ID, 'post_grid_exclude_post_id', true); $post_grid_query_order = get_post_meta($post->ID, 'post_grid_query_order', true); $post_grid_query_orderby = get_post_meta($post->ID, 'post_grid_query_orderby', true); $post_grid_posttype = get_post_meta($post->ID, 'post_grid_posttype', true); $post_grid_taxonomy = get_post_meta($post->ID, 'post_grid_taxonomy', true); $post_grid_taxonomy_category = get_post_meta($post->ID, 'post_grid_taxonomy_category', true); $post_grid_items_width = get_post_meta($post->ID, 'post_grid_items_width', true); $post_grid_items_width_mobile = get_post_meta($post->ID, 'post_grid_items_width_mobile', true); $post_grid_thumb_height = get_post_meta($post->ID, 'post_grid_thumb_height', true); $post_grid_meta_author_display = get_post_meta($post->ID, 'post_grid_meta_author_display', true); $post_grid_meta_avatar_display = get_post_meta($post->ID, 'post_grid_meta_avatar_display', true); $post_grid_meta_date_display = get_post_meta($post->ID, 'post_grid_meta_date_display', true); $post_grid_meta_categories_display = get_post_meta($post->ID, 'post_grid_meta_categories_display', true); $post_grid_meta_tags_display = get_post_meta($post->ID, 'post_grid_meta_tags_display', true); $post_grid_meta_comments_display = get_post_meta($post->ID, 'post_grid_meta_comments_display', true); $post_grid_items = get_post_meta($post->ID, 'post_grid_items', true); $post_grid_items_display = get_post_meta($post->ID, 'post_grid_items_display', true); $post_grid_post_meta_fields = get_post_meta($post->ID, 'post_grid_post_meta_fields', true); $post_grid_post_title_linked = get_post_meta($post->ID, 'post_grid_post_title_linked', true); $post_grid_post_thumbnail_linked = get_post_meta($post->ID, 'post_grid_post_thumbnail_linked', true); $post_grid_post_thumbnail_external = get_post_meta($post->ID, 'post_grid_post_thumbnail_external', true); $post_grid_hover_items_zoom_display = get_post_meta($post->ID, 'post_grid_hover_items_zoom_display', true); $post_grid_hover_items_link_display = get_post_meta($post->ID, 'post_grid_hover_items_link_display', true); $post_grid_hover_items_share_display = get_post_meta($post->ID, 'post_grid_hover_items_share_display', true); $post_grid_title_color = get_post_meta($post->ID, 'post_grid_title_color', true); $post_grid_title_font_size = get_post_meta($post->ID, 'post_grid_title_font_size', true); $post_grid_content_color = get_post_meta($post->ID, 'post_grid_content_color', true); $post_grid_content_font_size = get_post_meta($post->ID, 'post_grid_content_font_size', true); $post_grid_mixitup_post_per_page = get_post_meta($post->ID, 'post_grid_mixitup_post_per_page', true); $post_grid_mixitup_default_filter = get_post_meta($post->ID, 'post_grid_mixitup_default_filter', true); $post_grid_hover_items_hover_effect_in = get_post_meta($post->ID, 'post_grid_hover_items_hover_effect_in', true); $post_grid_custom_css = get_post_meta($post->ID, 'post_grid_custom_css', true); ?> <div class="para-settings post-grid-settings"> <div class="option-box"> <p class="option-title">Shortcode</p> <p class="option-info">Copy this shortcode and paste on page or post where you want to display post grid. <br />Use PHP code to your themes file to display post grid.</p> <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" >[post_grid <?php echo ' id="' . $post->ID . '"'; ?> ]</textarea> <br /><br /> PHP Code:<br /> <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[post_grid id='; echo "'" . $post->ID . "' ]"; echo '"); ?>'; ?> </textarea> </div> <ul class="tab-nav"> <li nav="1" class="nav1 active">Options</li> <li nav="2" class="nav2">Style</li> <li nav="3" class="nav3">Content</li> <li nav="4" class="nav4">MixItUp</li> <li nav="5" class="nav5">Grid Builder</li> <li nav="6" class="nav6">Custom CSS</li> </ul> <!-- tab-nav end --> <ul class="box"> <li style="display: block;" class="box1 tab-box active"> <div class="option-box"> <p class="option-title">Grid Post per page/Total post on grid</p> <p class="option-info">you can display pagination by set value post per page or display total max number of post on grid.</p> <input type="text" size="5" name="post_grid_post_per_page" value="<?php if (!empty($post_grid_post_per_page)) { echo $post_grid_post_per_page; } else { echo 10; } ?> " /> </div> <div class="option-box"> <p class="option-title">Display Pagination</p> <p class="option-info"></p> <select name="post_grid_pagination_display" > <option value="pagination" <?php if ($post_grid_pagination_display == "pagination") { echo "selected"; } ?> >Pagination</option> <option value="load_more" <?php if ($post_grid_pagination_display == "load_more") { echo "selected"; } ?> >Load More</option> <option value="no" <?php if ($post_grid_pagination_display == "no") { echo "selected"; } ?> >No</option> </select> </div> <div class="option-box"> <p class="option-title">Grid items width</p> <p class="option-info">Value with px, or %</p> <br> In Destop: <br> <input type="text" placeholder="ex: 250px" size="10" name="post_grid_items_width" value="<?php if (!empty($post_grid_items_width)) { echo $post_grid_items_width; } ?> " /> <br><br> In Mobile & Tabs: <br> <input type="text" placeholder="ex: 250px" size="10" name="post_grid_items_width_mobile" value="<?php if (!empty($post_grid_items_width_mobile)) { echo $post_grid_items_width_mobile; } ?> " /> </div> <div class="option-box"> <p class="option-title">Grid thumbnail height</p> <p class="option-info">Value with px</p> <input type="text" placeholder="ex: 150px" size="10" name="post_grid_thumb_height" value="<?php if (!empty($post_grid_thumb_height)) { echo $post_grid_thumb_height; } ?> " /> </div> </li> <li style="display: none;" class="box2 tab-box "> <div class="option-box"> <p class="option-title">Themes</p> <p class="option-info"></p> <?php $class_post_grid_functions = new class_post_grid_functions(); $themes_list = $class_post_grid_functions->post_grid_themes(); $post_grid_themes_list = $themes_list; ?> <select name="post_grid_themes" > <?php foreach ($post_grid_themes_list as $theme_key => $theme_name) { echo '<option value="' . $theme_key . '"'; if ($post_grid_themes == $theme_key) { echo 'selected="selected"'; } echo ' >' . $theme_name . '</option>'; } ?> </select> </div> <div class="option-box"> <p class="option-title">Active Masonry Grid</p> <p class="option-info">Masonry Style grid.</p> <select name="post_grid_masonry_enable" > <option value="no" <?php if ($post_grid_masonry_enable == "no") { echo "selected"; } ?> >No</option> <option value="yes" <?php if ($post_grid_masonry_enable == "yes") { echo "selected"; } ?> >Yes</option> </select> </div> <div class="option-box"> <p class="option-title"><?php _e('Background Image.', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Background image for post grid area.', 'post_grid'); ?> </p> <script> jQuery(document).ready(function(jQuery) { jQuery(".post_grid_bg_img_list li").click(function() { jQuery('.post_grid_bg_img_list li.bg-selected').removeClass('bg-selected'); jQuery(this).addClass('bg-selected'); var post_grid_bg_img = jQuery(this).attr('data-url'); jQuery('#post_grid_bg_img').val(post_grid_bg_img); }) }) </script> <?php $dir_path = post_grid_plugin_dir . "css/bg/"; $filenames = glob($dir_path . "*.png*"); $post_grid_bg_img = get_post_meta($post->ID, 'post_grid_bg_img', true); if (empty($post_grid_bg_img)) { $post_grid_bg_img = ""; } $count = count($filenames); $i = 0; echo "<ul class='post_grid_bg_img_list' >"; while ($i < $count) { $filelink = str_replace($dir_path, "", $filenames[$i]); $filelink = post_grid_plugin_url . "css/bg/" . $filelink; if ($post_grid_bg_img == $filelink) { echo '<li class="bg-selected" data-url="' . $filelink . '">'; } else { echo '<li data-url="' . $filelink . '">'; } echo "<img width='70px' height='50px' src='" . $filelink . "' />"; echo "</li>"; $i++; } echo "</ul>"; echo "<input style='width:100%;' value='" . $post_grid_bg_img . "' placeholder='Please select image or left blank' id='post_grid_bg_img' name='post_grid_bg_img' type='text' />"; ?> </div> <div class="option-box"> <p class="option-title"><?php _e('Thumbnail Size.', 'post_grid'); ?> </p> <p class="option-info"><?php _e('Thumbnail size of member on grid.', 'post_grid'); ?> </p> <select name="post_grid_thumb_size" > <option value="none" <?php if ($post_grid_thumb_size == "none") { echo "selected"; } ?> >None</option> <option value="thumbnail" <?php if ($post_grid_thumb_size == "thumbnail") { echo "selected"; } ?> >Thumbnail</option> <option value="medium" <?php if ($post_grid_thumb_size == "medium") { echo "selected"; } ?> >Medium</option> <option value="large" <?php if ($post_grid_thumb_size == "large") { echo "selected"; } ?> >Large</option> <option value="full" <?php if ($post_grid_thumb_size == "full") { echo "selected"; } ?> >Full</option> </select> </div> <div class="option-box"> <p class="option-title">Empty Thumbnail</p> <p class="option-info"></p> <input type="text" name="post_grid_empty_thumb" id="post_grid_empty_thumb" value="<?php if (!empty($post_grid_empty_thumb)) { echo $post_grid_empty_thumb; } ?> " /><br /> <input id="post_grid_empty_thumb_upload" class="post_grid_empty_thumb_upload button" type="button" value="Upload Image" /> <br /> <?php if (empty($post_grid_empty_thumb)) { ?> <img class="post_grid_empty_thumb_display" width="300px" src="<?php echo post_grid_plugin_url . 'css/no-thumb.png'; ?> " /> <?php } else { ?> <img class="post_grid_empty_thumb_display" width="300px" src="<?php echo $post_grid_empty_thumb; ?> " /> <?php } ?> <script> jQuery(document).ready(function($){ var custom_uploader; jQuery('#post_grid_empty_thumb_upload').click(function(e) { e.preventDefault(); //If the uploader object has already been created, reopen the dialog if (custom_uploader) { custom_uploader.open(); return; } //Extend the wp.media object custom_uploader = wp.media.frames.file_frame = wp.media({ title: 'Choose Image', button: { text: 'Choose Image' }, multiple: false }); //When a file is selected, grab the URL and set it as the text field's value custom_uploader.on('select', function() { attachment = custom_uploader.state().get('selection').first().toJSON(); jQuery('#post_grid_empty_thumb').val(attachment.url); jQuery('.post_grid_empty_thumb_display').attr('src',attachment.url); }); //Open the uploader dialog custom_uploader.open(); }); }) </script> </div> </li> <li style="display: none;" class="box3 tab-box "> <div class="option-box"> <p class="option-title">Post Query</p> <p class="option-info"></p> <div class="expandable"> <div class="items"> <div class="header">Post Types</div> <div class="options"> <?php $post_types = get_post_types('', 'names'); foreach ($post_types as $post_type) { if ($post_type == 'post') { echo '<label><input type="checkbox" name="post_grid_posttype[' . $post_type . ']" value ="' . $post_type . '" '; if (isset($post_grid_posttype[$post_type])) { echo "checked"; } echo ' >' . $post_type . '</label><br />'; } else { echo '<label><input type="checkbox" name="post_grid_posttype[' . $post_type . ']" value ="' . $post_type . '" '; if (isset($post_grid_posttype[$post_type])) { echo "checked"; } echo ' >' . $post_type . '</label><br />'; } } ?> </div> </div> <div class="items"> <div class="header"><?php _e('Post query order', 'post_grid'); ?> </div> <div class="options"> <select name="post_grid_query_order" > <option value="ASC" <?php if ($post_grid_query_order == "ASC") { echo "selected"; } ?> >ASC</option> <option value="DESC" <?php if ($post_grid_query_order == "DESC") { echo "selected"; } ?> >DESC</option> </select> </div> </div> <div class="items"> <div class="header"><?php _e('Post query orderby', 'post_grid'); ?> </div> <div class="options"> <select name="post_grid_query_orderby" > <option value="none" <?php if ($post_grid_query_orderby == "none") { echo "selected"; } ?> >None</option> <option value="ID" <?php if ($post_grid_query_orderby == "ID") { echo "selected"; } ?> >ID</option> <option value="date" <?php if ($post_grid_query_orderby == "date") { echo "selected"; } ?> >Date</option> <option value="rand" <?php if ($post_grid_query_orderby == "rand") { echo "selected"; } ?> >Rand</option> <option value="comment_count" <?php if ($post_grid_query_orderby == "comment_count") { echo "selected"; } ?> >Comment Count</option> <option value="author" <?php if ($post_grid_query_orderby == "author") { echo "selected"; } ?> >Author</option> <option value="title" <?php if ($post_grid_query_orderby == "title") { echo "selected"; } ?> >Title</option> <option value="name" <?php if ($post_grid_query_orderby == "name") { echo "selected"; } ?> >Name</option> <option value="type" <?php if ($post_grid_query_orderby == "type") { echo "selected"; } ?> >Type</option> </select> </div> </div> <div class="items"> <div class="header"><?php _e('Post Taxonomy & Catgory', 'post_grid'); ?> </div> <div class="options"> <div class="post-grid-reset-taxonomy button">Reset Taxonomy</div> <table style="width:100%;" > <tr style="overflow:scroll; vertical-align:top;"> <td style="overflow:scroll; vertical-align:top; padding:0; width:45%;"> <?php $post_grid_taxonomies = get_object_taxonomies($post_grid_posttype); if (!empty($post_grid_taxonomies)) { foreach ($post_grid_taxonomies as $taxonomy) { ?> <label ><input type="radio" class="post_grid_taxonomy" name="post_grid_taxonomy" value="<?php echo $taxonomy; ?> " <?php if ($post_grid_taxonomy == $taxonomy) { echo "checked"; } ?> /><?php echo $taxonomy; ?> </label><br /> <?php } } else { if (empty($post_grid_posttype)) { echo 'Please choose at least one post type and update settings.'; } else { echo 'No Taxomony found for '; echo '<strong>' . implode(', ', $post_grid_posttype) . '</strong>'; } } ?> </td> <td style=" height:auto;vertical-align:top; padding:0; width:45%;"> <span class="post_grid_loading_taxonomy_category" ></span> <div class="post_grid_taxonomy_category"> <?php if (!empty($post_grid_taxonomy)) { post_grid_get_taxonomy_category($post->ID); } else { } ?> </div> </td> </tr> </table> </div> </div> <div class="items"> <div class="header">Excerpt</div> <div class="options"> <p class="option-info">Content excerpt count</p> <input type="text" placeholder="30" name="post_grid_excerpt_count" value="<?php if (!empty($post_grid_excerpt_count)) { echo $post_grid_excerpt_count; } ?> " /><br /> <p class="option-info">Read more Text</p> <input type="text" placeholder="Read More" name="post_grid_read_more_text" value="<?php if (!empty($post_grid_read_more_text)) { echo $post_grid_read_more_text; } else { echo 'Read More'; } ?> " /> </div> </div> <div class="items"> <div class="header">Exclude</div> <div class="options"> you can exclude post by ID, comma(,) separated<br/> <input type="text" placeholder="5,3" name="post_grid_exclude_post_id" value="<?php if (!empty($post_grid_exclude_post_id)) { echo $post_grid_exclude_post_id; } else { echo ''; } ?> " /> </div> </div> </div> </div> </li> <li style="display: none;" class="box4 tab-box "> <div class="option-box"> <p class="option-title">MixItUp Post per page.</p> <p class="option-info"></p> <input type="text" size="5" name="post_grid_mixitup_post_per_page" value="<?php if (!empty($post_grid_mixitup_post_per_page)) { echo $post_grid_mixitup_post_per_page; } else { echo 6; } ?> " /> </div> <div class="option-box"> <p class="option-title">MixitUp default active filter.</p> <p class="option-info"></p> <?php //var_dump($post_grid_taxonomy_terms); //$post_grid_taxonomy = 'post_grid_group'; $post_grid_taxonomy_terms = $post_grid_taxonomy_category; if (!empty($post_grid_taxonomy_terms)) { foreach ($post_grid_taxonomy_terms as $term_id) { $term = get_term($term_id, $post_grid_taxonomy); $term_slug = $term->slug; $term_name = $term->name; echo '<label><input type="radio" name="post_grid_mixitup_default_filter" value="' . $term_slug . '" '; if ($post_grid_mixitup_default_filter == $term_slug) { echo 'checked'; } echo '/>' . $term_name . '</label><br />'; } } else { echo 'Please select post_grid group first from <b>Content(tab) > Filter Member > Display from Member Group</b>.'; } ?> </div> </li> <li style="display: none;" class="box5 tab-box "> <div class="option-box"> <p class="option-title">Grid Builder</p> <p class="option-info"></p> <?php $Postgridbuilder = new PostgridClass(); echo $Postgridbuilder->settings_grid_items(); ?> <script> jQuery(document).ready(function($) { jQuery(function() { $( ".items-container" ).sortable(); //$( ".items-container" ).disableSelection(); }); }) </script> </div> </li> <li style="display: none;" class="box6 tab-box"> <div class="option-box"> <p class="option-title"><?php _e('Custom CSS for this Post Grid.', 'post_grid'); ?> </p> <p class="option-info">Do not use <style></style> tag, you can use bellow prefix to your css, sometime you need use "!important" to overrid. <br/> <b>#post-grid-container-<?php echo $post->ID; ?> </b> </p> <?php $empty_css_sample = '.post-grid-container-' . $post->ID . '{}\\n.post-grid-container-' . $post->ID . ' .post-grid-items{}\\n.post-grid-container-' . $post->ID . ' .grid-single{}'; ?> <textarea style="width:80%; min-height:150px" name="post_grid_custom_css"><?php if (!empty($post_grid_custom_css)) { echo htmlentities($post_grid_custom_css); } else { echo str_replace('\\n', PHP_EOL, $empty_css_sample); } ?> </textarea> </div> </li> </ul> </div> <script> jQuery(document).ready(function($) { <?php $post_grid_license_key = get_option('post_grid_license_key'); if (empty($post_grid_license_key)) { echo '$("#post_grid_metabox .para-settings").fadeOut();'; echo '$("#post_grid_metabox .inside").html("<b>' . post_grid_plugin_name . ' Error:</b> Please activate your license.");'; } ?> }); </script> <?php }
<?php /* * @Author pickplugins * Copyright: 2015 pickplugins.com */ if (!defined('ABSPATH')) { exit; } // if direct access $class_post_grid_functions = new class_post_grid_functions(); $items_bg_color_values = $class_post_grid_functions->items_bg_color_values(); //var_dump($items_bg_color_values); $post_grid_layout_content = get_option('post_grid_layout_content'); if (empty($post_grid_layout_content)) { $layout = $class_post_grid_functions->layout_content($layout_content); } else { if (!empty($post_grid_layout_content[$layout_content])) { $layout = $post_grid_layout_content[$layout_content]; } else { $layout = array(); } } $html .= '<style type="text/css">'; foreach ($layout as $item_id => $item_info) { $item_css = $item_info['css']; $item_key = $item_info['key']; //var_dump($item_key); if ($item_key == 'categories' || $item_key == 'tags') { $html .= '#post-grid-' . $post_id . ' .element_' . $item_id . ' a{' . $item_css . '}'; } else {
?> <form method="post" action="<?php echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']); ?> "> <input type="hidden" name="post_grid_hidden" value="Y"> <?php settings_fields('post_grid_plugin_options'); do_settings_sections('post_grid_plugin_options'); if (!empty($_GET['layout_content'])) { $layout_content = sanitize_text_field($_GET['layout_content']); } else { $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
function post_grid_post_settings_input($post) { global $post; wp_nonce_field('post_grid_post_settings_input', 'post_grid_post_settings_input_nonce'); $post_grid_post_settings = get_post_meta($post->ID, 'post_grid_post_settings', true); if (!empty($post_grid_post_settings['post_skin'])) { $post_skin = $post_grid_post_settings['post_skin']; } else { $post_skin = 'flat'; } if (!empty($post_grid_post_settings['custom_thumb_source'])) { $custom_thumb_source = $post_grid_post_settings['custom_thumb_source']; } else { $custom_thumb_source = post_grid_plugin_url . 'assets/frontend/css/images/placeholder.png'; } if (!empty($post_grid_post_settings['font_awesome_icon'])) { $font_awesome_icon = $post_grid_post_settings['font_awesome_icon']; } else { $font_awesome_icon = ''; } if (!empty($post_grid_post_settings['font_awesome_icon_color'])) { $font_awesome_icon_color = $post_grid_post_settings['font_awesome_icon_color']; } else { $font_awesome_icon_color = '#737272'; } if (!empty($post_grid_post_settings['font_awesome_icon_size'])) { $font_awesome_icon_size = $post_grid_post_settings['font_awesome_icon_size']; } else { $font_awesome_icon_size = '50px'; } if (!empty($post_grid_post_settings['custom_youtube_id'])) { $custom_youtube_id = $post_grid_post_settings['custom_youtube_id']; } else { $custom_youtube_id = ''; } if (!empty($post_grid_post_settings['custom_vimeo_id'])) { $custom_vimeo_id = $post_grid_post_settings['custom_vimeo_id']; } else { $custom_vimeo_id = ''; } if (!empty($post_grid_post_settings['custom_mp3_url'])) { $custom_mp3_url = $post_grid_post_settings['custom_mp3_url']; } else { $custom_mp3_url = ''; } if (!empty($post_grid_post_settings['custom_soundcloud_id'])) { $custom_soundcloud_id = $post_grid_post_settings['custom_soundcloud_id']; } else { $custom_soundcloud_id = ''; } //var_dump($post_skin); ?> <div class="para-settings post-grid-metabox"> <ul class="tab-nav"> <li nav="1" class="nav1 active"><i class="fa fa-code"></i> <?php _e('Options', post_grid_textdomain); ?> </li> <li nav="2" class="nav2"><i class="fa fa-bookmark-o"></i> <?php _e('Font Awesome', post_grid_textdomain); ?> </li> <li nav="3" class="nav3"><i class="fa fa-play"></i> <?php _e('Custom Media', post_grid_textdomain); ?> </li> </ul> <!-- tab-nav end --> <ul class="box"> <li style="display: block;" class="box1 tab-box active"> <div class="option-box"> <p class="option-title"><?php _e('Post Skin', post_grid_textdomain); ?> </p> <p class="option-info"><?php _e('Default skin for this post only', post_grid_textdomain); ?> </p> <select class="post_skin" name="post_grid_post_settings[post_skin]"> <option value="" <?php if ($post_skin == '') { echo "selected"; } ?> >None</option> <?php $class_post_grid_functions = new class_post_grid_functions(); $post_grid_skins = $class_post_grid_functions->skins(); //var_dump($post_grid_skins); foreach ($post_grid_skins as $skin_key => $skin_data) { ?> <option value="<?php echo $skin_key; ?> " <?php if ($post_skin == $skin_key) { echo "selected"; } ?> ><?php echo $skin_data['name']; ?> </option> <?php } ?> </select> </div> <div class="option-box"> <p class="option-title"><?php _e('Custom thumbnail source', post_grid_textdomain); ?> </p> <p class="option-info"></p> <input type="text" name="post_grid_post_settings[custom_thumb_source]" value="<?php echo $custom_thumb_source; ?> " /> </div> </li> <li style="display: none;" class="box2 tab-box"> <div class="option-box"> <p class="option-title"><?php _e('Font awesome icon ID', post_grid_textdomain); ?> </p> <p class="option-info"><?php _e('Font awesome icon id, ex: <b>fa-share-alt</b> , please check font awesome incon here <a href="http://fortawesome.github.io/Font-Awesome/icons/">http://fortawesome.github.io/Font-Awesome/icons/</a>', post_grid_textdomain); ?> </p> <input placeholder="fa-share-alt" type="text" name="post_grid_post_settings[font_awesome_icon]" value="<?php echo $font_awesome_icon; ?> " /> <p class="option-info"><?php _e('Icon Color', post_grid_textdomain); ?> </p> <input placeholder="" class="color" type="text" name="post_grid_post_settings[font_awesome_icon_color]" value="<?php echo $font_awesome_icon_color; ?> " /> <p class="option-info"><?php _e('Icon size', post_grid_textdomain); ?> </p> <input placeholder="50px" type="text" name="post_grid_post_settings[font_awesome_icon_size]" value="<?php echo $font_awesome_icon_size; ?> " /> </div> </li> <li style="display: none;" class="box3 tab-box"> <div class="option-box"> <p class="option-title"></p> <p class="option-info"><?php _e('Custom youtube id', post_grid_textdomain); ?> </p> <input placeholder="S97MaG3kOMY" type="text" name="post_grid_post_settings[custom_youtube_id]" value="<?php echo $custom_youtube_id; ?> " /> <p class="option-info"><?php _e('Custom vimeo id', post_grid_textdomain); ?> </p> <input placeholder="152379391" type="text" name="post_grid_post_settings[custom_vimeo_id]" value="<?php echo $custom_vimeo_id; ?> " /> <p class="option-info"><?php _e('Custom mp3 URL', post_grid_textdomain); ?> </p> <input placeholder="http://hello.com/file/song.mp3" type="text" name="post_grid_post_settings[custom_mp3_url]" value="<?php echo $custom_mp3_url; ?> " /> <p class="option-info"><?php _e('Custom soundcloud ID', post_grid_textdomain); ?> </p> <input placeholder="237668695" type="text" name="post_grid_post_settings[custom_soundcloud_id]" value="<?php echo $custom_soundcloud_id; ?> " /> </div> </li> </ul> </div> <?php }