Permalink
Browse files

Fix #17; Fix #43; Allow excerpts; Add auto-excerpt option

  • Loading branch information...
lacymorrow committed Oct 16, 2014
1 parent 49fa1e6 commit acbea7eca74f62bb43ed94fd6562f07476cb0e09
Showing with 57 additions and 29 deletions.
  1. +22 −20 content.php
  2. +9 −0 functions.php
  3. +20 −3 inc/customizer.php
  4. +6 −6 languages/casper.pot
View
@@ -37,24 +37,26 @@
<noscript><?php the_post_thumbnail('thumbnail'); ?></noscript>
<?php } ?>
</header>
- <?php if ( is_search() ) : // Only display Excerpts for Search ?>
- <section class="post-excerpt">
- <p><?php the_excerpt(); ?></p>
- </section><!-- .entry-summary -->
- <?php else : ?>
- <section class="post-content">
- <?php if ( false != get_theme_mod( 'casper_read_more_link')) {
- the_content( get_theme_mod( 'casper_read_more_link') );
- } else {
- the_content( __( '&hellip;&nbsp;<span class="meta-nav">&rarr;</span>', 'casper' ) );
- } ?>
- <?php
- wp_link_pages( array(
- 'before' => '<div class="page-links">' . __( 'Pages:', 'casper' ),
- 'after' => '</div>',
- ) );
- ?>
- <div class="clear">&nbsp;</div>
- </section>
- <?php endif; ?>
+ <section class="post-content">
+
+ <?php
+ if ( false != get_theme_mod( 'casper_read_more_link')) {
+ $read_more = get_theme_mod( 'casper_read_more_link');
+ } else {
+ $read_more = __( '&hellip;&nbsp;<span class="meta-nav">&rarr;</span>', 'casper' );
+ }
+ if ( has_excerpt() || false != get_theme_mod( 'casper_auto_excerpt') ) {
+ the_excerpt();
+ } else {
+ the_content( $read_more );
+ }
+ ?>
+ <?php
+ wp_link_pages( array(
+ 'before' => '<div class="page-links">' . __( 'Pages:', 'casper' ),
+ 'after' => '</div>',
+ ) );
+ ?>
+ <div class="clear">&nbsp;</div>
+ </section>
</article><!-- #post-## -->
View
@@ -62,6 +62,15 @@ function casper_setup() {
'gallery',
) );
+ function new_excerpt_more( $more ) {
+ if ( false != get_theme_mod( 'casper_read_more_link')) {
+ return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">' . get_theme_mod( 'casper_read_more_link') . '</a>';
+ } else {
+ return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">' . __( '&hellip;&nbsp;<span class="meta-nav">&rarr;</span>', 'casper' ) . '</a>';
+ }
+ }
+ add_filter( 'excerpt_more', 'new_excerpt_more' );
+
// Enable automatic theme updates
add_filter( 'auto_update_theme', '__return_true' );
}
View
@@ -234,6 +234,23 @@ public function render_content() {
'type' => 'checkbox'
)
);
+ // Automatically limit post summary
+ $wp_customize->add_setting(
+ 'casper_auto_excerpt',
+ array(
+ 'default' => false,
+ 'transport' => 'refresh'
+ )
+ );
+ $wp_customize->add_control(
+ 'casper_auto_excerpt',
+ array(
+ 'priority' => 6,
+ 'section' => 'casper_custom',
+ 'label' => 'Auto-limit summary length',
+ 'type' => 'checkbox'
+ )
+ );
// Don't display Categories
$wp_customize->add_setting(
'casper_hide_categories',
@@ -245,7 +262,7 @@ public function render_content() {
$wp_customize->add_control(
'casper_hide_categories',
array(
- 'priority' => 6,
+ 'priority' => 7,
'section' => 'casper_custom',
'label' => 'Don\'t display categories',
'type' => 'checkbox'
@@ -262,7 +279,7 @@ public function render_content() {
$wp_customize->add_control(
'casper_hide_tags',
array(
- 'priority' => 7,
+ 'priority' => 8,
'section' => 'casper_custom',
'label' => 'Don\'t display tags',
'type' => 'checkbox'
@@ -279,7 +296,7 @@ public function render_content() {
$wp_customize->add_control(
'casper_hide_dates',
array(
- 'priority' => 8,
+ 'priority' => 9,
'section' => 'casper_custom',
'label' => 'Don\'t display dates',
'type' => 'checkbox'
View
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Casper 1.1.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-10-15 22:23-0700\n"
+"POT-Creation-Date: 2014-10-15 23:17-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -187,27 +187,27 @@ msgstr ""
msgid " in "
msgstr ""
-#: content-page.php:47 content-single.php:45
+#: content-page.php:47 content-single.php:45 content.php:22
msgid "Edit&rarr;"
msgstr ""
-#: content-page.php:66
+#: content-page.php:67
msgid "Edit"
msgstr ""
#: content-single.php:68
msgid "&hellip;&nbsp<span class=\"meta-nav\">&rarr;</span>"
msgstr ""
-#: content-single.php:71 content.php:52
+#: content-single.php:71 content.php:56
msgid "Pages:"
msgstr ""
#: content.php:20
msgid " on "
msgstr ""
-#: content.php:48
+#: content.php:46 functions.php:69
msgid "&hellip;&nbsp;<span class=\"meta-nav\">&rarr;</span>"
msgstr ""
@@ -224,7 +224,7 @@ msgstr ""
msgid "Primary Menu"
msgstr ""
-#: functions.php:77
+#: functions.php:86
msgid "Footer Bar"
msgstr ""

0 comments on commit acbea7e

Please sign in to comment.