Permalink
Browse files

Merge pull request #122 from goulvench/108-speaker-description-language

Wrap speaker description with a div specifying language, fixes #108
  • Loading branch information...
2 parents 4e96011 + 8501e0b commit 114c9f83ba038c8a68f3d77c1400b9ae6983404d @DirtyF DirtyF committed Apr 15, 2012
Showing with 30 additions and 1 deletion.
  1. +13 −0 functions.php
  2. +15 −0 lib/plugin/speaker.php
  3. +2 −1 page-article.php
View
@@ -293,3 +293,16 @@ function theme_excerpt_more($more) {
global $post;
return '… <a href="'. get_permalink($post->ID) . '" title="'. get_the_title($post->ID) .'" rel="bookmark">'.__('(more...)').'</a>';
}
+
+/**
+ * Echoes the lang attribute, whatever the post type
+ * @return null
+ */
+function sudweb_the_lang_attribute() {
+ global $post;
+ $func = $post->post_type . '_lang_attribute';
+ if (function_exists($func)){
+ $func();
+ }
+ return;
+}
@@ -49,3 +49,18 @@ function sudweb_register_speaker()
)
));
}
+
+/**
+ * Displays the lang attribute for a given speaker
+ *
+ * @param null $speaker_id
+ * @return null
+ */
+function speaker_lang_attribute($speaker_id = null)
+{
+ echo str_replace(
+ array('Français', 'Anglais', 'English'),
+ array('fr', 'en', 'en'),
+ trim(get_field('language', $speaker_id === null ? get_the_ID() : $speaker_id))
+ );
+}
View
@@ -9,6 +9,7 @@
<?php endif; ?>
</h1>
</header>
-
+ <div lang="<?php sudweb_the_lang_attribute() ?>">
<?php the_content() ?>
+ </div>
</article>

0 comments on commit 114c9f8

Please sign in to comment.