This plugin adds a shortcode called [add_title] that can be used in WordPress excerpts to display the post title. If content is provided in the shortcode, it will use that, otherwise it will display the post's title. The shortcode returns the title wrapped in a span with a class of "add_title".
1 of 1
Download to read offline
More Related Content
Add title shortcode
1. add_excerpt_shortcode.php 2011-11-06
<?php
/*
Plugin Name: Add Title Shortcode
Plugin URI: http://semperfiwebdesign.com/
Description: Adds an [add_title] shortcode for use with wordpress excerpts.
Version: 1.1
Author: Semper Fi Web Design
Author URI: http://semperfiwebdesign.com/
*/
if ( ! function_exists( 'sfwd_add_title_shortcode' ) ) {
function sfwd_add_title_shortcode($atts, $content='') {
if ($content) {
$title = $content;
} else {
$title = get_the_title();
}
return '<span class="add_title">'.$title.'</span>';
}
}
add_shortcode( 'add_title', 'sfwd_add_title_shortcode' );
?>
- 1/1 -