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 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']);
$title = $atts['title'];
$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">
<img class="pedagogicalicon" alt="' . $title . '" src="' . $img . '">
<img class="pedagogicalicon" alt="' . $label . '" src="' . $img . '">
<h2>' . $title . '</h2>
......@@ -367,7 +369,7 @@
<div class="panel-body">
<div class="col-md-12">'
. $atts['body'] .
. $content .
......@@ -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>
<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>[oeru_idevice type="Question" title="What do you think?"]<br>
What is the best way to do this?</br>
<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>
......@@ -120,7 +125,7 @@ function oeru_theme_shortcodes(){
<li>Web Resources</li>
<li>Web resources</li>
<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:
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:
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
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment