<?
/*
Plugin Name: WP Subtitle
Plugin URI: http://www.husani.com/ventures/wordpress-plugins/wp-subtitle/
Description: Add a subtitle to pages and posts.  Place &lt;?=the_subtitle()?&gt; where you'd like the subtitle to appear.  Similar to the_title, you can pass before, after, and display arguments.  Documentation included in this plugin's readme file.  Get help at <a href="http://forums.husani.com/forum/wp-subtitle/" target="_blank">support forums</a> and sign up for the <a href="http://www.husani.com/ventures/wordpress-plugins/wp-subtitle/mailing-list/" target="_blank">mailing list</a> to receive updates and news about WP Subtitle.  By <a href="http://www.husani.com" target="_blank">Husani Oakley</a>.
Author
Version: 1.0
*/

/*  Copyright 2009  Husani Oakley  (email : wordpressplugins@husani.com)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

/**
 * query db and echo page/post subtitle, if any
 */
function wps_get_the_subtitle(){
  global $post;
  echo get_post_meta($post->ID, "wps_subtitle", true);
}

/** HOOKS */
add_action('admin_menu', 'wps_addPanelXHTML');
add_action('save_post', 'wps_saveSubtitle');

/** FUNCTIONS FOR HOOKS */

/**
 * display xhtml for subtitle panel
 */
function wps_addPanelXHTML(){
  if( function_exists( 'add_meta_box' )) {
    add_meta_box('wps_panel', 'Page Subtitle', 'wps_showSubtitlePanel', 'page', 'normal', 'high');
    add_meta_box('wps_panel', 'Post Subtitle', 'wps_showSubtitlePanel', 'post', 'normal', 'high');
  } else {
    add_action('dbx_page_advanced', 'wps_showSubtitlePanelOld');
    add_action('dbx_post_advanced', 'wps_showSubtitlePanelOld');
  }
  //include css if admin
  if(is_admin()){
    add_action('admin_print_styles', 'wps_addPanelCSS');
  }
}

/**
 * include CSS for subtitle panel
 */
function wps_addPanelCSS(){
  $css = WP_PLUGIN_URL . '/wp-subtitle/admin/css/panel.css';
  wp_register_style('wps_css', $css);
  wp_enqueue_style( 'wps_css');
}

/**
 * include XHTML for form inside panel
 */
function wps_showSubtitlePanel(){
  include ABSPATH . PLUGINDIR . "/wp-subtitle/admin/panel.inc.php";
}

/**
 * for pre-2.5, include shell for panel
 */
function wps_showSubtitlePanelOld(){
  include ABSPATH . PLUGINDIR . "/wp-subtitle/admin/compat_panel.inc.php";
}

/**
 * store subtitle content in db as custom field
 */
function wps_saveSubtitle($post_id){
  //verify
  if (!wp_verify_nonce( $_POST['wps_noncename'], 'wp-subtitle')) {
    return $post_id;
  }
  if ('page' == $_POST['post_type']){
    if (!current_user_can('edit_page', $post_id)){
      return $post_id;
    }
  } else {
    if (!current_user_can('edit_post', $post_id)){
      return $post_id;
    }
  }
  //save data
  if(!update_post_meta($post_id, "wps_subtitle", $_POST["wps_subtitle"])){
    add_post_meta($post_id, "wps_subtitle", $_POST["wps_subtitle"]);
  }
}

/**
 * return subtitle from post inside The Loop
 */
function the_subtitle($before="", $after="", $display=true){
  global $post;
  $subtitle = $before . get_post_meta($post->ID, "wps_subtitle", true) . $after;
  if($display){
    echo $subtitle;
  } else {
    return $subtitle;
  }
}

/**
 * return (or display) subtitle from post with ID passed as argument
 */
function get_the_subtitle($id, $before="", $after="", $display=true){
  $subtitle = $before . get_post_meta($id, "wps_subtitle", true) . $after;
  if($display){
    echo $subtitle;
  } else {
    return $subtitle;
  }
}


?><?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AMERICAN GRIDLOCK &#187; Endorsements</title>
	<atom:link href="http://americangridlock.com/category/endorsements/feed/" rel="self" type="application/rss+xml" />
	<link>http://americangridlock.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Tue, 07 Feb 2012 07:35:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Christoph Kampitsch</title>
		<link>http://americangridlock.com/2011/12/13/christoph-kampitsch/</link>
		<comments>http://americangridlock.com/2011/12/13/christoph-kampitsch/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:50:03 +0000</pubDate>
		<dc:creator>American Gridlock Editor</dc:creator>
				<category><![CDATA[Endorsements]]></category>

		<guid isPermaLink="false">http://americangridlock.com/?p=125</guid>
		<description><![CDATA[“H. Woody Brock has the rare ability to explain complex issues for simple minds like me. I wish Europe had someone like him who tells the public and governments what has to be done today to be able to prosper in the future.”]]></description>
			<content:encoded><![CDATA[<p>“H. Woody Brock has the rare ability to explain complex issues for simple minds like me. I wish Europe had someone like him who tells the public and governments what has to be done today to be able to prosper in the future.”</p>
]]></content:encoded>
			<wfw:commentRss>http://americangridlock.com/2011/12/13/christoph-kampitsch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jonathan Kelly</title>
		<link>http://americangridlock.com/2011/12/13/jonathan-kelly/</link>
		<comments>http://americangridlock.com/2011/12/13/jonathan-kelly/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:49:26 +0000</pubDate>
		<dc:creator>American Gridlock Editor</dc:creator>
				<category><![CDATA[Endorsements]]></category>

		<guid isPermaLink="false">http://americangridlock.com/?p=123</guid>
		<description><![CDATA[“Americans are awakening to the realization that our economic challenges require deeper solutions than the short-sighted sound bites offered up by politicians defending their piece of the status quo. Having watched Woody Brock take on and rigorously solve many of the complex questions of economics and finance over the last 20 years, I am thrilled [...]]]></description>
			<content:encoded><![CDATA[<p>“Americans are awakening to the realization that our economic challenges require deeper solutions than the short-sighted sound bites offered up by politicians defending their piece of the status quo.  Having watched Woody Brock take on and rigorously solve many of the complex questions of economics and finance over the last 20 years, I am thrilled that he has produced a manifesto for how to refocus economic policy.  I urge everyone to give it their full attention.”</p>
]]></content:encoded>
			<wfw:commentRss>http://americangridlock.com/2011/12/13/jonathan-kelly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>David Villa</title>
		<link>http://americangridlock.com/2011/12/13/david-villa/</link>
		<comments>http://americangridlock.com/2011/12/13/david-villa/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:48:49 +0000</pubDate>
		<dc:creator>American Gridlock Editor</dc:creator>
				<category><![CDATA[Endorsements]]></category>

		<guid isPermaLink="false">http://americangridlock.com/?p=121</guid>
		<description><![CDATA[“For the past fifteen years, Woody’s essays challenged this reader to consider the range of outcomes as a distribution, not a single expectation. Woody helps readers answer the question, ‘what am I missing’?”]]></description>
			<content:encoded><![CDATA[<p>“For the past fifteen years, Woody’s essays challenged this reader to consider the range of outcomes as a distribution, not a single expectation.  Woody helps readers answer the question, ‘what am I missing’?”</p>
]]></content:encoded>
			<wfw:commentRss>http://americangridlock.com/2011/12/13/david-villa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jeffrey L. Knight</title>
		<link>http://americangridlock.com/2011/12/13/scobie-d-ward-2/</link>
		<comments>http://americangridlock.com/2011/12/13/scobie-d-ward-2/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:44:14 +0000</pubDate>
		<dc:creator>American Gridlock Editor</dc:creator>
				<category><![CDATA[Endorsements]]></category>

		<guid isPermaLink="false">http://americangridlock.com/?p=117</guid>
		<description><![CDATA[“For years, Woody has provided for clients like me a framework to understand, and anticipate, world events. Woody’s style is unique, focusing on truth and disciplined deduction rather than data and interpretation, and his style works. Here, Woody applies his methods to some of America’s biggest challenges, and not a moment too soon.”]]></description>
			<content:encoded><![CDATA[<p>“For years, Woody has provided for clients like me a framework to understand, and anticipate, world events.  Woody’s style is unique, focusing on truth and disciplined deduction rather than data and interpretation, and his style works.   Here, Woody applies his methods to some of America’s biggest challenges, and not a moment too soon.”</p>
]]></content:encoded>
			<wfw:commentRss>http://americangridlock.com/2011/12/13/scobie-d-ward-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scobie D. Ward</title>
		<link>http://americangridlock.com/2011/12/13/scobie-d-ward/</link>
		<comments>http://americangridlock.com/2011/12/13/scobie-d-ward/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:43:34 +0000</pubDate>
		<dc:creator>American Gridlock Editor</dc:creator>
				<category><![CDATA[Endorsements]]></category>

		<guid isPermaLink="false">http://americangridlock.com/?p=115</guid>
		<description><![CDATA[“A must read for policy makers and investors alike, American Gridlock applies much needed clear thinking to the challenges of today and opportunities for tomorrow.”]]></description>
			<content:encoded><![CDATA[<p>“A must read for policy makers and investors alike, <em>American Gridlock</em> applies much needed clear thinking to the challenges of today and opportunities for tomorrow.”</p>
]]></content:encoded>
			<wfw:commentRss>http://americangridlock.com/2011/12/13/scobie-d-ward/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alfred Roelli</title>
		<link>http://americangridlock.com/2011/12/13/alfred-roelli/</link>
		<comments>http://americangridlock.com/2011/12/13/alfred-roelli/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:42:56 +0000</pubDate>
		<dc:creator>American Gridlock Editor</dc:creator>
				<category><![CDATA[Endorsements]]></category>

		<guid isPermaLink="false">http://americangridlock.com/?p=113</guid>
		<description><![CDATA[“For over a quarter of a century, Woody Brock has been carefully constructing tools to analyze and understand key issues in economics and finance. Against the prevalent backdrop of a sterile ‘Waste Land’ of ephemeral information, his Socratic “correct thinking” allows him to address policy issues and to propose elegant and relevant solutions. I have [...]]]></description>
			<content:encoded><![CDATA[<p>“For over a quarter of a century, Woody Brock has been carefully constructing tools to analyze and understand key issues in economics and finance. Against the prevalent backdrop of a sterile ‘Waste Land’ of ephemeral information, his Socratic “correct thinking” allows him to address policy issues and to propose elegant and relevant solutions. I have enjoyed everything I ever read by Woody and he has been invaluable in investment matters at several critical junctures over the last quarter century. Finding a sort of summa of his thought in one astonishing piece of work is a pure pleasure.”</p>
]]></content:encoded>
			<wfw:commentRss>http://americangridlock.com/2011/12/13/alfred-roelli/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paul Desmarais, Jr.</title>
		<link>http://americangridlock.com/2011/12/13/paul-desmarais/</link>
		<comments>http://americangridlock.com/2011/12/13/paul-desmarais/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:42:18 +0000</pubDate>
		<dc:creator>American Gridlock Editor</dc:creator>
				<category><![CDATA[Endorsements]]></category>

		<guid isPermaLink="false">http://americangridlock.com/?p=111</guid>
		<description><![CDATA[“Woody Brock brings clarity to complexity. For over two decades we have been exposed to Woody Brock’s novel approach to understanding the numerous economic issues that we have confronted in making long-term investments. His insight and ability to simplifying complex issues has helped us better comprehend the major economic shifts that affect all of us [...]]]></description>
			<content:encoded><![CDATA[<p>“Woody Brock brings clarity to complexity. For over two decades we have been exposed to Woody Brock’s novel approach to understanding the numerous economic issues that we have confronted in making long-term investments. His insight and ability to simplifying complex issues has helped us better comprehend the major economic shifts that affect all of us in today’s business world.”</p>
]]></content:encoded>
			<wfw:commentRss>http://americangridlock.com/2011/12/13/paul-desmarais/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>David Hale</title>
		<link>http://americangridlock.com/2011/12/13/david-hale/</link>
		<comments>http://americangridlock.com/2011/12/13/david-hale/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:41:47 +0000</pubDate>
		<dc:creator>American Gridlock Editor</dc:creator>
				<category><![CDATA[Endorsements]]></category>

		<guid isPermaLink="false">http://americangridlock.com/?p=109</guid>
		<description><![CDATA[“Woody Brock’s book offers some innovative proposals to prevent the US from experiencing a lost decade. He addresses issues as diverse as the health care crisis, the country’s need for greater infrastructure investment, the origins of the recent financial crisis, and China’s mercantilist trade strategy. He offers a truly comprehensive perspective rooted in a search [...]]]></description>
			<content:encoded><![CDATA[<p> “Woody Brock’s book offers some innovative proposals to prevent the US from experiencing a lost decade. He addresses issues as diverse as the health care crisis, the country’s need for greater infrastructure investment, the origins of the recent financial crisis, and China’s mercantilist trade strategy. He offers a truly comprehensive perspective rooted in a search for justice.”</p>
]]></content:encoded>
			<wfw:commentRss>http://americangridlock.com/2011/12/13/david-hale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rudolf Stahl</title>
		<link>http://americangridlock.com/2011/12/13/rudolf-stahl/</link>
		<comments>http://americangridlock.com/2011/12/13/rudolf-stahl/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:41:18 +0000</pubDate>
		<dc:creator>American Gridlock Editor</dc:creator>
				<category><![CDATA[Endorsements]]></category>

		<guid isPermaLink="false">http://americangridlock.com/?p=107</guid>
		<description><![CDATA[“This book is a timely reminder of the benevolent power of rigorous logical analysis when applied to even the thorniest of issues affecting our societies. It is an inspiration to anybody deeply troubled by the seeming demise of the moral, political and economic foundations of the West. A brilliant and marvellously constructive contribution to a [...]]]></description>
			<content:encoded><![CDATA[<p>“This book is a timely reminder of the benevolent power of rigorous logical analysis when applied to even the thorniest of issues affecting our societies. It is an inspiration to anybody deeply troubled by the seeming demise of the moral, political and economic foundations of the West.  A brilliant and marvellously constructive contribution to a desperately needed political dialogue.” </p>
]]></content:encoded>
			<wfw:commentRss>http://americangridlock.com/2011/12/13/rudolf-stahl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gary Bruebaker</title>
		<link>http://americangridlock.com/2011/12/13/gary-bruebaker/</link>
		<comments>http://americangridlock.com/2011/12/13/gary-bruebaker/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:40:49 +0000</pubDate>
		<dc:creator>American Gridlock Editor</dc:creator>
				<category><![CDATA[Endorsements]]></category>

		<guid isPermaLink="false">http://americangridlock.com/?p=105</guid>
		<description><![CDATA[“I have had the privilege of knowing Woody for almost 3 decades. As usual, Woody uses his unique style to cut through the noise and misconceptions to land squarely on the real issues at hand. Woody correctly points out that solutions to our nation’s most important challenges will require reasoning from First Principles to move [...]]]></description>
			<content:encoded><![CDATA[<p> “I have had the privilege of knowing Woody for almost 3 decades. As usual, Woody uses his unique style to cut through the noise and misconceptions to land squarely on the real issues at hand. Woody correctly points out that solutions to our nation’s most important challenges will require reasoning from First Principles to move from gridlock to win-win solutions. Woody’s observations are always thought provoking.” </p>
]]></content:encoded>
			<wfw:commentRss>http://americangridlock.com/2011/12/13/gary-bruebaker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
