<h3 class="post-subtitle"> <?php clean_blog_wp_excerpt('clean_blog_wp_index'); // Build your custom callback length in functions.php ?> </h3> </a> <p class="post-meta">Posted by <?php the_author_posts_link(); ?> on <?php the_time('F j, Y'); ?> <?php echo get_post_category(); ?> </p> <p class="post-edit"><?php edit_post_link(); ?> </p> </div> <hr> </article> <!-- /article --> <?php }
public function posting($on = 1) { $fields = array("title", "type", "content", "intro", "youtube", "is_report"); $data = array(); foreach ($fields as $field) { $data[$field] = $this->input->post($field); } $this->load->library("htmlpurifierhelper"); $config = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($config); $category = get_post_category(); if (!isset($category[$data["type"]])) { die("not exist category"); } $data["content"] = $purifier->purify($data["content"]); $data["intro"] = $purifier->purify($data["intro"]); $inserted_data = array(); //$inserted_data["bl_sn"] = $inserted_data["title"] = $data["title"]; $inserted_data["article"] = $data["content"]; $inserted_data["article_desc"] = strip_tags($data["content"]); //article_pic $inserted_data["date_year"] = date("Y"); $inserted_data["date_month"] = date("m"); $inserted_data["date_day"] = date("d"); $inserted_data["date_ym"] = date("Ym"); $inserted_data["is_news"] = $data["is_report"] != "" ? 1 : 0; if ($on == 1) { $inserted_data["is_on"] = 1; } else { $inserted_data["is_on"] = 0; } $inserted_data["date_new"] = db_current_date(); $inserted_data["date_update"] = db_current_date(); $this->load->model("blogModel"); $this->blogModel->insert_blog_post($this->_mem->mem_sn, $inserted_data); redirect(site_url("member/posts")); }
public function posts() { $aPostCate = I('get.post_cate', 0, 'intval'); if (!empty($aPostCate)) { $where['cate_id'] = $aPostCate; $this->assign('name', get_post_category($aPostCate)); $this->assign('postCate', $aPostCate); } $where['status'] = 1; $post_list = D('Group/GroupPost')->getList(array('where' => $where)); $this->assign('list', $post_list); $this->assignPostCategory(); $this->display(); }
function widget($args, $instance) { global $post; $location = $args['id']; $args['offset'] = $instance['offset'] ? intval($instance['offset']) - 1 : 0; $args['category_id'] = isset($instance['category_id']) && $instance['category_id'] != 0 ? $instance['category_id'] : ''; $args['size'] = isset($instance['size']) ? $instance['size'] : 'small'; $args['post_id'] = isset($instance['post_id']) ? $instance['post_id'] : null; $options = array('posts_per_page' => 1, 'post_type' => array('post'), 'orderby' => 'date', 'order' => 'DESC', 'post_status' => 'publish'); if ($args['post_id']) { $options['p'] = $args['post_id']; } else { $options['offset'] = $args['offset']; if ($args['category_id']) { $options['category__in'] = array($args['category_id']); } } $custom_query = new WP_Query($options); if ($custom_query->have_posts()) { echo $args['before_widget']; $i = 0; while ($custom_query->have_posts()) { $custom_query->the_post(); switch ($args['size']) { case 'large': $image_size = array('width' => 320, 'height' => 222); break; case 'medium': $image_size = array('width' => 320, 'height' => 294); break; case 'small': default: $image_size = array('width' => 320, 'height' => 222); break; } if ($location == 'homepage_carousel') { $image_size = array('width' => 840, 'height' => 480); } $author_id = get_the_author_meta('ID'); $category = get_post_category(); $module = $location == 'homepage_carousel' ? 'post-slide' : 'post-item'; $sub_category = get_post_sub_category(); if (!$sub_category || $location == 'homepage_carousel') { $sub_category = $category; } if ($location != 'homepage_carousel') { include_module('post-top-category', array('name' => $category->name)); } $data = array('title' => get_the_title(), 'excerpt' => get_excerpt(150), 'url' => get_permalink(), 'image_url' => get_post_thumbnail_src($image_size), 'author' => array('name' => get_the_author(), 'image_url' => get_avatar_url(get_the_author_meta('ID'), 40), 'url' => get_author_posts_url($author_id)), 'category' => array('name' => $sub_category->name), 'read_more' => true, 'date' => get_the_date(), 'class' => 'has-sub-category'); include_module($module, $data); $i++; } echo $args['after_widget']; wp_reset_postdata(); wp_reset_query(); } }