示例#1
0
文件: Page.php 项目: mitogh/katana
 /**
  * Filter that allow to change the sizes on pages that uses custom
  * page templates.
  *
  * @since 1.1.0
  *
  * @param array $sizes The images sizes.
  * @param int   $id The id of the post, page or custom post type.
  * @return return the array with the new sizes.
  */
 public function filter_by_template_page($sizes, $id = 0)
 {
     $template = get_page_template_slug($id);
     if (empty($template)) {
         return $sizes;
     }
     $template_name = Formatter::to_filter_format($template);
     return apply_filters(Formatter::katana_filter($template_name), $sizes);
 }
示例#2
0
文件: Post.php 项目: mitogh/katana
 /**
  * Creates a filter based on the post_type like: katana_refine_%s
  * where %s is the post type can be: 'post', 'page' or a custom one.
  *
  * @since 1.0.0
  *
  * @param array $sizes The images sizes.
  * @param int   $post_id The id of the post, page or custom post type.
  * @return return the array with the new sizes.
  */
 public function filter_by_post_type($sizes, $post_id = 0)
 {
     $type = get_post_type($post_id);
     return apply_filters(Formatter::katana_filter($type), $sizes);
 }