Changeset 519451
- Timestamp:
- 03/15/2012 05:15:34 PM (14 years ago)
- Location:
- posts-in-page/trunk
- Files:
-
- 2 edited
-
posts_in_page.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
posts-in-page/trunk/posts_in_page.php
r511252 r519451 48 48 global $wp_query; 49 49 $this->args = array( 'post_type' => ( $atts['post_type'] ) ? $atts['post_type'] : 'post' ); 50 if( $atts['template'] ) $this->args['template'] = $atts['template']; 50 51 if( $atts['category'] ){ 51 52 $cats = explode( ',', $atts['category'] ); … … 70 71 71 72 protected function has_theme_template(){ 72 $template_file = ( $this->args['template'] ) ? get_theme_root() . '/' . $this->args['template'] : get_theme_root() . '/posts_loop_template.php'; 73 $template_file = ( $this->args['template'] ) ? self::current_theme_path() . '/' . $this->args['template'] : self::current_theme_path() . '/posts_loop_template.php'; 74 73 75 return ( file_exists( $template_file ) ) ? $template_file : false; 74 76 } … … 77 79 $ic_posts->the_post(); 78 80 ob_start(); 79 require ( $file_path = self::has_theme_template() ) ? $file_path: 'posts_loop_template.php';81 require ( $file_path = self::has_theme_template() ) ? str_replace( site_url(), '', $file_path ) : 'posts_loop_template.php'; 80 82 $output .= ob_get_contents(); 81 83 return ob_get_clean(); 82 84 } 83 85 86 protected function current_theme_path(){ 87 $theme_data = explode( '/', get_bloginfo( 'stylesheet_directory' ) ); 88 $theme_path = get_theme_root(); 89 return $theme_path . '/' . $theme_data[ count( $theme_data ) -1 ]; 90 } 91 84 92 } new AddPostsToPage(); -
posts-in-page/trunk/readme.txt
r511261 r519451 1 1 === Posts in Page === 2 2 Contributors: dgilfoy, ivycat 3 Tags: widgets, sidebar, role based3 Tags: shortcode, pages, posts, custom post types 4 4 Requires at least: 3.0 5 5 Tested up to: 3.1
Note: See TracChangeset
for help on using the changeset viewer.