diff options
| author | Horus3 | 2014-09-11 14:36:57 +0200 |
|---|---|---|
| committer | Horus3 | 2014-09-11 14:36:57 +0200 |
| commit | a74b3c31f95f72cf2aac7e74b77d319eb6bf34c6 (patch) | |
| tree | 51ff6bc43083428dd3c4faae59d3ea61105a08e9 | |
| parent | 2e42dd3c875bde5a464c4077e1ea5d424eca1a3f (diff) | |
| download | dotfiles-a74b3c31f95f72cf2aac7e74b77d319eb6bf34c6.tar.gz | |
wp: read more button for custom excerpts
| -rw-r--r-- | wordpress/functions.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/wordpress/functions.php b/wordpress/functions.php index 464d9a3..ff849a2 100644 --- a/wordpress/functions.php +++ b/wordpress/functions.php @@ -9,6 +9,7 @@ function movejquerytofooter(){ wp_enqueue_script('jquery'); } } +add_action( 'init', 'movejquerytofooter'); // Disable W3TC footer comment for everyone but Admins (single site & network mode) if ( !current_user_can( 'activate_plugins' ) ) { @@ -22,3 +23,12 @@ function var_piwik() { wp_enqueue_script('piwik'); } } +add_action( 'init', 'var_piwik'); + +// Add "Read more" button to custom excerpts +function custom_excerpt($text) { + $text = preg_replace('/<\/p>$/', '', $text ); + $excerpt = $text . '<br><a class="read-more-button" href="'. esc_url( get_permalink() ).'">' . __( 'Read more', 'papercuts' ) . '</a></p>'; + return $excerpt; +} +add_filter('the_excerpt', 'custom_excerpt'); |
