"Global Settings",
"id" => "ahscp_global_settings",
"type" => "header3"),
array("name" => "Title Style",
"id" => "ahscp_titletype",
'size'=>50,
'std'=>'h3',
'help'=>'This is the HTML tag used for post titles in the shortcode. You can override this default setting in any individual use of the shortcode by including the option title. (Ignored for instances of the shortcode using a template.)'),
array("name" => "Content Style",
"id" => "ahscp_contentstyle",
'type'=>'select',
'options'=>array('full'=>'full','excerpt'=>'excerpt','title'=>'title'),
'help'=>'This controls whether and how each post\'s content is displayed. You can override this default setting in any individual use of the shortcode by including the option content_style. (Ignored for instances of the shortcode using a template.)'),
array("name" => "Date Format",
"id" => "ahscp_dateformat",
'size'=>100,
'help'=>'If you enter a date format here, it will be used to insert the post date for all posts on the site. You can override this default setting in any individual use of the shortcode by including the option dateformat and setting it to a different format or to empty.
A nice default is F j. See PHP.net\'s Date Formatting Instructions for more.'),
array("name" => "Order by",
"id" => "ahscp_orderby",
'type'=>'select',
'options'=>array('post_date'=>'Post Date','rand'=>'Random',),
'help'=>'Usually, you want it to be by the date of the post, but you can choose to make it random. You can override this default setting in any individual use of the shortcode by including the option orderby.'),
array("name" => "Styling",
"id" => "ahscp_css",
'type'=>'textarea',
'help'=>'When you first install this plugin, this box will have the default css that I put in, mostly to style the 2-column and sidebox options. You can edit this css easily here.'),
array("name" => "Custom Field",
"id" => "ahscp_customfield",
'size'=>150,
'help'=>'The shortcode automatically orders posts by most-recent-first. If you\'d like them to be ordered by a custom field, enter the name of the custom field here. You can override this default setting in any individual use of the shortcode by including the option custom_field. If you set a custom_field value here, but want it to NOT impact a particular shortcode instances, set its value to false.'),
/* Templates tab */
array("name" => "Templates",
"id" => "ahscp_templates",
"type" => "header3"),
array("name" => "Number of templates",
"id" => "ahscp_tmplnum",
"type" => "select",
'options'=>range(0,10),
),
);
for ($i=1;$i<=get_option('ahscp_tmplnum');$i++) {
$ahscp_options[] = array(
'id'=>'ahscp_tmpl_'.$i,
'name'=>'Template #'.$i,
'type'=>'header4',
);
$ahscp_options[] = array(
'id'=>'ahscp_tmpl_'.$i.'_title',
'name'=>'Name',
'type'=>'text',
'std'=>'Template #'.$i,
);
$ahscp_options[] = array(
"id" => 'ahscp_tmpl_'.$i.'_group',
"name" => "Grouping Type",
"type" => "select",
'options'=>array('<div>','<ul>'),
'help'=>'Put the posts, each of which will use the template below, into a parent <div> or a parent <ul>?',
);
$ahscp_options[] = array(
'id'=>'ahscp_tmpl_'.$i.'_text',
'name'=>'Text',
'type'=>'textarea'
);
}
$ahscp_options[] = array("name" => "Template Tags",
"id" => "ahscp_tmpltags",
'type'=>'header4',
'help'=>'
%%TITLE%% - post title
%%URL%% - post permalink
%%IMAGE%% - post thumbnail image
%%DATE%% - post date
%%CONTENT%% - post content
%%CONTENTNOIMG%% - post content with images removed
%%EXCERPT%% - post excerpt
%%EDITLINK%% - link to edit the post (displayed as tiny pencil)
%%CATEGORY%% - the (first) category you used in the shortcode
',
);
function ahscp_add_admin() {
global $ahscp_options;
// add hidden field to store last-used tab
$ahscp_options[] = array('id'=>'ahscp_activetab','type'=>'hidden','divclass'=>'hidden','std'=>2);
if ( $_GET['page'] == basename(__FILE__) ) {
if ( 'save' == $_REQUEST['action'] ) {
foreach ($ahscp_options as $value) {
update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
foreach ($ahscp_options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } }
header("Location: options-general.php?page=".basename(__FILE__)."&saved=true");
die;
} else if ( 'reset' == $_REQUEST['action'] ) {
foreach ($ahscp_options as $value) delete_option( $value['id'] );
header("Location: options-general.php?page=".basename(__FILE__)."&reset=true");
die;
}
}
add_submenu_page('options-general.php', 'April\'s Call Posts', 'April\'s Call Posts', 8, basename(__FILE__), 'ahscp_adminpage');
}
function ahscp_adminpage() {
global $ahscp_options;
if ( $_REQUEST['saved'] ) $msg = '
Call Posts settings saved.
Call Posts ssettings reset.
Built by Aaron Silver of Springthistle Tech
'; } add_action('admin_head', 'ahscp_admin_head'); // Set the default options when the plugin is activated function ahs_callposts_activate(){ add_option('ahscp_css', ".callposts_2col .post { float: left; margin-right: 20px; border-bottom: 1px solid #999; overflow: hidden; clear: none; }\n.callposts_2col .post h3 { margin-bottom: 0; }\n.callposts_2col .clr { height: 20px; }\n.callposts.whitespace { background: #fff; width: 225px; float: right; margin-right: -10px; padding: 0 0 10px 10px; }\n.callposts .floatbox { background-color: #eee; padding: 15px; float: right; margin: 10px -10px 10px 10px;}\n.clr { clear: both; }"); add_option('ahscp_tmplnum', '3'); add_option('ahscp_tmpl_1_title', 'Simple linked titles list'); add_option('ahscp_tmpl_1_group', '1'); add_option('ahscp_tmpl_1_text', '%%CONTENT%%