Skip to content

Commit

Permalink
Improve Accordion display for Templates, Template parts and Patterns #11
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Oct 1, 2022
1 parent 9cd284b commit 8cb7540
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
6 changes: 5 additions & 1 deletion css/oik-themes.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* (C) Copyright Bobbing Wide 2015, 2016 */
/* (C) Copyright Bobbing Wide 2015, 2016, 2022 */
/* Styling for the output of oik-themes to be similar to wordpress.org for the TwentyTwelve theme
and different for Genesis based themes
*/
Expand Down Expand Up @@ -57,4 +57,8 @@ div.theme-info:after { clear: left; }
}


.bw_accordion_item pre {
overflow: auto;
font-size: 0.8em;
}

44 changes: 23 additions & 21 deletions includes/class-oik-themes-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -713,11 +713,11 @@ function list_files($files) {
}

function accordion( $files, $type ) {
oik_require( "shortcodes/oik-jquery.php" );
bw_jquery_enqueue_script( "jquery-ui-accordion" );
bw_jquery_enqueue_style( "jquery-ui-accordion" );
//oik_require( "shortcodes/oik-jquery.php" );
//bw_jquery_enqueue_script( "jquery-ui-accordion" );
//bw_jquery_enqueue_style( "jquery-ui-accordion" );
$selector = $this->bw_accordion_id();
bw_jquery( "#$selector", "accordion", '{ heightStyle: "content"}' );
//bw_jquery( "#$selector", "accordion", '{ heightStyle: "content"}' );
$class = "bw_accordion";
sdiv( $class, $selector );

Expand All @@ -730,23 +730,25 @@ function accordion( $files, $type ) {
return bw_ret();
}

function format_accordion( $file, $type=null ) {
//bw_format_accordion()
h3( basename( $file ) );
$contents = file_get_contents( $file );
$contents = str_replace( '[', '[', $contents);
//bw_geshi_it()
sdiv();
if ( 'patterns' === $type ) {
$this->preview_pattern($file, $contents);
}
stag( 'pre', 'pattern');
e( esc_html( $contents ));
etag( 'pre');

ediv();


function format_accordion( $file, $type=null ) {
sdiv('bw_accordion_item');
stag('details');
stag('summary');
e(basename($file));
etag('summary');
$contents = file_get_contents($file);
$contents = str_replace('[', '[', $contents);
//bw_geshi_it()
sdiv();
if ('patterns' === $type) {
$this->preview_pattern($file, $contents);
}
stag('pre', 'pattern');
e(esc_html($contents));
etag('pre');
ediv();
etag('details');
ediv();
}

function preview_pattern( $file, $contents ) {
Expand Down

0 comments on commit 8cb7540

Please sign in to comment.