Plugin Directory

Changeset 519451


Ignore:
Timestamp:
03/15/2012 05:15:34 PM (14 years ago)
Author:
dgilfoy
Message:

fixed issue with templates in theme directory not being linked

Location:
posts-in-page/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • posts-in-page/trunk/posts_in_page.php

    r511252 r519451  
    4848        global $wp_query;
    4949        $this->args = array( 'post_type' => (  $atts['post_type'] ) ? $atts['post_type'] : 'post' );
     50        if( $atts['template'] ) $this->args['template'] = $atts['template'];
    5051        if( $atts['category'] ){
    5152            $cats = explode( ',', $atts['category'] );
     
    7071   
    7172    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       
    7375        return ( file_exists( $template_file ) ) ? $template_file : false;
    7476    }
     
    7779      $ic_posts->the_post();
    7880      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';
    8082      $output .= ob_get_contents();
    8183      return ob_get_clean();
    8284   }
    8385   
     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   
    8492} new AddPostsToPage();
  • posts-in-page/trunk/readme.txt

    r511261 r519451  
    11=== Posts in Page ===
    22Contributors: dgilfoy, ivycat
    3 Tags: widgets, sidebar, role based
     3Tags: shortcode, pages, posts, custom post types
    44Requires at least: 3.0
    55Tested up to: 3.1
Note: See TracChangeset for help on using the changeset viewer.