Skip to content

Commit

Permalink
Display cached patterns if available. #11
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Jan 22, 2022
1 parent bba0177 commit 1e7ef92
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions includes/class-oik-themes-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,16 +654,25 @@ function get_subdir_file_list( $dir, $masks ) {
}

function display_patterns( $post, $slug ) {
$additional_content = '';
$files = $this->get_all_patterns( $slug );


e( sprintf( _n( '%$1s pattern', '%1$s patterns', 'oik-themes'), count( $files ) ) );
$additional_content .= $this->accordion($files, 'patterns');
$additional_content = null;
$additional_content = $this->display_all_cached_patterns( $slug );
if ( null === $additional_content ) {
$files = $this->get_all_patterns($slug);
e(sprintf(_n('%$1s pattern', '%1$s patterns', 'oik-themes'), count($files)));
$additional_content .= $this->accordion($files, 'patterns');
}
return $additional_content;
}


function display_all_cached_patterns( $slug ) {
$additional_content = null;
if ( function_exists( 'oik_patterns_loaded')) {
oik_require('libs/class-oik-patterns-import.php', 'oik-patterns');
$oik_patterns_import = new OIK_patterns_import($slug);
$additional_content = $oik_patterns_import->display_cached_patterns();
}
return $additional_content;
}

function list_files($files) {
$content = '<ol>';
Expand Down

0 comments on commit 1e7ef92

Please sign in to comment.