Commit 39c4de2f authored by Jim Tittsler's avatar Jim Tittsler

0.5.0: make oeru_idevice a wrapping shortcode

Do not change capitalization of iDevice title
parent 4a68569d
......@@ -288,7 +288,7 @@
return isset($v) ? $v : $default;
}
function device($atts){
function device( $atts, $content = null ){
// map iDevice type to icon
// see http://wikieducator.org/Template:IDevice subpages
$icon = array(
......@@ -344,22 +344,24 @@
$label = $atts['type'];
$atts['type'] = strtolower($atts['type']);
$img = get_template_directory_uri() . '/idevices/' . $this->array_get($icon[get_theme_mod('icon_set', 'Line')][$atts['type']], $icon[get_theme_mod('icon_set')]['default']);
$img = get_template_directory_uri() . '/idevices/' . $this->array_get($icon[get_theme_mod('icon_set', 'Line')][strtolower($atts['type'])], $icon[get_theme_mod('icon_set')]['default']);
if(isset($atts['title'])){
$title = $atts['title'];
}else{
$title = $label;
}
$title = ucfirst(strtolower($title));
// FIXME the WP Codex claimed $content will be null for the self-closing
// form, but in practice it is an empty string (WordPress 4.x)
if ( empty( $content ) ) {
$content = $atts['body'];
}
return '<div class="panel">
<div class="panel-heading idevice-heading">
<div>
<img class="pedagogicalicon" alt="' . $title . '" src="' . $img . '">
<img class="pedagogicalicon" alt="' . $label . '" src="' . $img . '">
</div>
<div>
<h2>' . $title . '</h2>
......@@ -367,7 +369,7 @@
</div>
<div class="panel-body">
<div class="col-md-12">'
. $atts['body'] .
. $content .
'</div>
</div>
</div>';
......
......@@ -86,11 +86,16 @@ function oeru_theme_shortcodes(){
<p>The headings value is the top row of the table, with each | separating a column heading</p>
<p>Then each value in order from the first is a cell in the table</p>
<h2>[oeru_idevice]</h2>
<p>Use this to add a table</p>
<p>Use this to add a pedagogical template</p>
<p>Example [oeru_idevice type="Question" body="What is the best way to do this"]</p>
<p>The type value sets the title on the page and the associated image. Body sets what appears below this</p>
<p>If you use title="This is my title" the title will become this instead.</p>
<p>The types are as follows</p>
<p><em>or</em></p>
<p>[oeru_idevice type="Question" title="What do you think?"]<br>
What is the best way to do this?</br>
[/oeru_idevice]</p>
<p><em>Because of a limitation in WordPress, the two types must not be mixed on a page.</em></p>
<p>The type value sets the title on the page and the associated image. Body sets what appears below this.</p>
<p>If you use title="This is my title" it overrides the displayed title for this iDevice.</p>
<p>The types are as follows:</p>
<ul>
<li>Activity</li>
<li>Portfolio</li>
......@@ -120,7 +125,7 @@ function oeru_theme_shortcodes(){
<li>Assessment</li>
<li>Reflection</li>
<li>Preknowledge</li>
<li>Web Resources</li>
<li>Web resources</li>
</ul>
<h2>[oeru_fitb]</h2>
<p>Use this to create a fill in the blank area</p>
......
......@@ -3,7 +3,7 @@ Theme Name: OERu Course Theme
Author: Pgogy Webstuff
Author URI: http://pgogywebstuff.com
Description: Open Class Theme for the OERu
Version: 0.4.2
Version: 0.5.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: fixed-layout, responsive-layout, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, full-width-template, rtl-language-support, sticky-post, theme-options
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment