Guest User

Untitled

a guest
Aug 5th, 2010
154
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.  
  4. //
  5. // Gallery Child Theme Functions
  6. //
  7.  
  8. function childtheme_menu_args($args) {
  9. $args = array(
  10. 'show_home' => 'Home',
  11. 'sort_column' => 'menu_order',
  12. 'menu_class' => 'menu',
  13. 'echo' => true
  14. );
  15. return $args;
  16. }
  17. add_filter('wp_page_menu_args', 'childtheme_menu_args');
  18.  
  19. // Adds a link to the author and other contributors
  20. function childtheme_theme_link($themelink) {
  21. return $themelink . ' &amp; <a href="http://chris-wallace.com/2009/05/04/gallery-wordpress-theme/" title="Gallery Wordpress Theme" rel="designer">Gallery WordPress Theme</a> by <a href="http://chris-wallace.com">Chris Wallace</a>.<br /> Released by <a href="http://www.smashingmagazine.com">Smashing Magazine</a>. <a href="http://www.komodomedia.com/blog/2008/12/social-media-mini-iconpack/" title="Social Media Icons">Social Media Icons</a> by Rogie King';
  22. }
  23. add_filter('thematic_theme_link', 'childtheme_theme_link');
  24.  
  25. // Add a drop down category menu
  26. function childtheme_menus() { ?>
  27. <div id="page-menu" class="menu">
  28. <ul id="page-nav" class="sf-menu">
  29. <li class="rss"><a href="<?php bloginfo('rss2_url'); ?>">RSS Feed</a></li>
  30. <?php wp_list_pages('title_li='); ?>
  31. </ul>
  32. </div>
  33. <div id="category-menu" class="menu">
  34. <ul id="category-nav" class="sf-menu">
  35. <li class="home"><a href="<? bloginfo('url'); ?>">Home</a></li>
  36. <?php wp_list_categories('title_li=&number=7'); ?>
  37. <li class="blog-description"><span><?php bloginfo('description'); ?></span></li>
  38. </ul>
  39. </div>
  40. <?php }
  41. add_action('wp_page_menu','childtheme_menus');
  42.  
  43. // Remove sidebar on gallery-style pages
  44. function remove_sidebar() {
  45. if(is_page()){
  46. return TRUE;
  47. } else {
  48. return FALSE;
  49. }
  50. }
  51.  
  52. add_filter('thematic_sidebar', 'remove_sidebar');
  53.  
  54. // Change the Navigation
  55.  
  56. // Remove Navigation Above & Below
  57. function remove_navigation() {
  58. remove_action('thematic_navigation_above', 'thematic_nav_above', 2);
  59. remove_action('thematic_navigation_below', 'thematic_nav_below', 2);
  60. }
  61. add_action('init', 'remove_navigation');
  62.  
  63. // re-create thematic_nav_below
  64.  
  65. function gallery_nav_below() {
  66. if (!(is_single())) { ?>
  67.  
  68. <div id="nav-below" class="navigation">
  69. <?php if(function_exists('wp_pagenavi')) { ?>
  70. <?php wp_pagenavi(); ?>
  71. <?php } else { ?>
  72. <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'thematic')) ?></div>
  73. <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'thematic')) ?></div>
  74. <?php } ?>
  75. </div>
  76.  
  77. <?php
  78. }
  79. }
  80.  
  81. add_action('thematic_navigation_below', 'gallery_nav_below');
  82.  
  83. // End of NAVIGATION
  84.  
  85. // Creating the content for the INDEX
  86. function remove_index_loop() {
  87. remove_action('thematic_indexloop', 'thematic_index_loop');
  88. }
  89. add_action('init', 'remove_index_loop');
  90.  
  91. function gallery_index_loop() {
  92. global $post;
  93. /* Count the number of posts so we can insert a widgetized area */ $count = 1;
  94. while ( have_posts() ) : the_post() ?>
  95.  
  96. <div id="post-<?php the_ID() ?>" class="<?php
  97. thematic_post_class();
  98. if(function_exists('p75GetVideo')){
  99. if(p75GetVideo($post->ID)){
  100. echo " video";
  101. }
  102. }
  103. ?>">
  104. <div class="entry-content">
  105. <?php childtheme_post_header() ?>
  106. <a href="<?php echo the_permalink() ?>"><span class="slide-title"><?php echo the_title(); ?></span>
  107. <img class="thumbnail" src="<?php if(get_post_meta($post->ID, 'thumbnail', $single = true)){echo get_post_meta($post->ID, 'thumbnail', $single = true);} else{bloginfo('url'); echo "/wp-content/themes/gallery/images/thumbnail-default.jpg";} ?>" width="125" height="125" alt="<?php echo the_title() ?>" /></a>
  108. </div>
  109. </div><!-- .post -->
  110.  
  111. <?php comments_template();
  112.  
  113. if ($count==$thm_insert_position) {
  114. get_sidebar('index-insert');
  115. }
  116. $count = $count + 1;
  117. endwhile;
  118. }
  119. add_action('thematic_indexloop', 'gallery_index_loop');
  120. // End of INDEX
  121.  
  122. //Creating the content for the Single Post
  123. function remove_single_post() {
  124. remove_action('thematic_singlepost', 'thematic_single_post');
  125. }
  126. add_action('init', 'remove_single_post');
  127.  
  128. function gallery_single_post() {
  129. global $post;
  130. if(function_exists('file_get_contents')){
  131. $shortenedurl = file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode(get_permalink()));
  132. } else {
  133. $shortenedurl = urlencode(get_permalink());
  134. }
  135. ?>
  136. <div id="post-<?php the_ID(); ?>" class="<?php
  137. thematic_post_class();
  138. if(function_exists('p75GetVideo')){
  139. if(p75GetVideo($post->ID)){
  140. echo " video";
  141. $video = 1;
  142. }
  143. }
  144. ?>">
  145. <div class="entry-content">
  146. <?php if(function_exists('the_ratings')) { echo the_ratings(); } ?>
  147. <h1><?php the_title(); ?></h1>
  148. <?php the_content(''.__('Read More <span class="meta-nav">&raquo;</span>', 'thematic').''); ?>
  149. <ul class="meta">
  150. <?php if(get_post_meta($post->ID, 'designed-by')){ ?><li class="designer">Designed by: <?php echo get_post_meta($post->ID, 'designed-by', $single = true); ?></li><?php } ?>
  151. <?php if(get_post_meta($post->ID, 'web-url')){ ?>
  152. <li class="site-link"><a rel="source" href="<?php echo get_post_meta($post->ID, 'web-url', $single = true); ?>"><?php echo get_post_meta($post->ID, 'web-url', $single = true); ?></a></li>
  153. <li class="delicious"><a href="http://del.icio.us/post?url=<?php echo get_post_meta($post->ID, 'web-url', $single = true); ?>&amp;<?php the_title(); ?>">Bookmark This (<?php echo get_post_meta($post->ID, 'web-url', $single = true); ?>)</a></li>
  154. <li class="twitter"><a href="http://www.twitter.com/home?status=<?php echo str_replace(' ', '+', the_title_attribute('echo=0')); echo '+' . $shortenedurl; echo "+(via+@mixcss)"; ?>" title="Share <?php the_title_attribute(); ?> on Twitter">Tweet This</a></li>
  155. <?php } ?>
  156. </ul>
  157. <div id="nav-below" class="navigation">
  158. <div class="nav-previous"><?php previous_post_link('%link', '<span class="meta-nav">&laquo;</span> %title') ?></div>
  159. <div class="nav-next"><?php next_post_link('%link', '%title <span class="meta-nav">&raquo;</span>') ?></div>
  160. </div>
  161. </div>
  162. </div><!-- .post -->
  163.  
  164. <div class="artwork-container">
  165. <div class="entry-artwork">
  166. <?php if($video==1) {echo p75GetVideo($post->ID); }
  167. else{ ?>
  168. <?php if(get_post_meta($post->ID, 'web-url')){ ?>
  169. <a href="<?php echo get_post_meta($post->ID, 'web-url', $single = true); ?>"><img src="<?php if(get_post_meta($post->ID, 'full-image')){echo get_post_meta($post->ID, 'full-image', $single = true);}else{bloginfo('url'); echo '/wp-content/themes/gallery/images/full-image-default.jpg';} ?>" alt="<?php echo get_post_meta($post->ID, 'web-url', $single = true); ?>"/></a>
  170. <?php }else{ ?>
  171. <img src="<?php if(get_post_meta($post->ID, 'full-image')){echo get_post_meta($post->ID, 'full-image', $single = true);}else{echo '/wp-content/themes/gallery/images/full-image-default.jpg';} ?>" alt="<?php echo get_post_meta($post->ID, 'web-url', $single = true); ?>"/>
  172. <?php } ?>
  173. <?php }?>
  174. </div>
  175. </div>
  176. <?php
  177. }
  178. add_action('thematic_singlepost', 'gallery_single_post');
  179.  
  180. // End of SINGLE
  181.  
  182. //Creating the content for the Archive
  183. function remove_archive_loop() {
  184. remove_action('thematic_archiveloop', 'thematic_archive_loop');
  185. }
  186. add_action('init', 'remove_archive_loop');
  187.  
  188. function gallery_archive_loop() {
  189. global $post;
  190. while ( have_posts() ) : the_post(); ?>
  191.  
  192. <div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>">
  193. <div class="entry-content">
  194. <?php childtheme_post_header() ?>
  195. <a href="<?php echo the_permalink() ?>"><span class="slide-title"><?php echo the_title(); ?></span><img class="thumbnail" src="<?php if(get_post_meta($post->ID, 'thumbnail')){echo get_post_meta($post->ID, 'thumbnail', $single = true);} else{bloginfo('url'); echo "/wp-content/themes/gallery/images/thumbnail-default.jpg";} ?>" width="125" height="125" alt="<?php echo the_title() ?>" /></a>
  196. </div>
  197. </div><!-- .post -->
  198.  
  199. <?php endwhile;
  200. }
  201. add_action('thematic_archiveloop', 'gallery_archive_loop');
  202.  
  203. // End of ARCHIVE
  204.  
  205. //Creating the content for the Category
  206. function remove_category_loop() {
  207. remove_action('thematic_categoryloop', 'thematic_category_loop');
  208. }
  209. add_action('init', 'remove_category_loop');
  210.  
  211. function gallery_category_loop() {
  212. global $post;
  213. /* Count the number of posts so we can insert a widgetized area */ $count = 1;
  214. while ( have_posts() ) : the_post() ?>
  215.  
  216. <div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>">
  217. <div class="entry-content">
  218. <?php childtheme_post_header() ?>
  219. <a href="<?php echo the_permalink() ?>"><span class="slide-title"><?php echo the_title(); ?></span><img class="thumbnail" src="<?php if(get_post_meta($post->ID, 'thumbnail')){echo get_post_meta($post->ID, 'thumbnail', $single = true);} else{bloginfo('url'); echo "/wp-content/themes/gallery/images/thumbnail-default.jpg";} ?>" width="125" height="125" alt="<?php echo the_title() ?>" /></a>
  220. </div>
  221. </div><!-- .post -->
  222.  
  223. <?php comments_template();
  224.  
  225. if ($count==$thm_insert_position) {
  226. get_sidebar('index-insert');
  227. }
  228. $count = $count + 1;
  229. endwhile;
  230. }
  231. add_action('thematic_categoryloop', 'gallery_category_loop');
  232.  
  233. // End of CATEGORY
  234.  
  235. // Creating the content for the Tag
  236. function remove_tag_loop() {
  237. remove_action('thematic_tagloop', 'thematic_tag_loop');
  238. }
  239. add_action('init', 'remove_tag_loop');
  240.  
  241. function gallery_tag_loop() {
  242. global $post;
  243. /* Count the number of posts so we can insert a widgetized area */ $count = 1;
  244. while ( have_posts() ) : the_post() ?>
  245.  
  246. <div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>">
  247. <div class="entry-content">
  248. <?php childtheme_post_header() ?>
  249. <a href="<?php echo the_permalink() ?>"><span class="slide-title"><?php echo the_title(); ?></span><img class="thumbnail" src="<?php if(get_post_meta($post->ID, 'thumbnail')){echo get_post_meta($post->ID, 'thumbnail', $single = true);} else{bloginfo('url'); echo "/wp-content/themes/gallery/images/thumbnail-default.jpg";} ?>" width="125" height="125" alt="<?php echo the_title() ?>" /></a>
  250. </div>
  251. </div><!-- .post -->
  252.  
  253. <?php comments_template();
  254.  
  255. if ($count==$thm_insert_position) {
  256. get_sidebar('index-insert');
  257. }
  258. $count = $count + 1;
  259. endwhile;
  260. }
  261. add_action('thematic_tagloop', 'gallery_tag_loop');
  262.  
  263. // End of TAG
  264.  
  265. // Filter the Page Title
  266. function gallery_page_title ($content) {
  267. if (is_category()) {
  268. $content = '<h1 class="page-title"><span>';
  269. $content .= single_cat_title("", false);
  270. $content .= '</span></h1>';
  271. if ( !(''== category_description()) ) {
  272. $content .= '<div class="archive-meta">';
  273. $content .= apply_filters('archive_meta', category_description());
  274. $content .= '</div>';
  275. }
  276. } elseif (is_tag()) {
  277. $content = '<h1 class="page-title"><span>';
  278. $content = thematic_tag_query();
  279. $content = '</span></h1>';
  280. }
  281. return $content;
  282. }
  283. add_filter('thematic_page_title', 'gallery_page_title');
  284. // End of Filter the Page Title
  285.  
  286. // Add fix for ie6 styles
  287. function fix_ie6(){
  288. echo ' <!--[if lt IE 7]>
  289. <script src="/wp-content/themes/gallery/js/DD_belatedPNG.js"></script>
  290. <script type="text/javascript">
  291. DD_belatedPNG.fix("body,#wrapper, ul.meta li,#blog-title a,#access,#access a,.new,#comments h3,ul.children li,.cover-up,.entry-content .post-ratings img,.post-ratings-image");
  292. </script>
  293. <![endif]-->';
  294.  
  295. }
  296.  
  297. // Add slider and lazyload
  298. function gallery_slider(){
  299. echo '<script type="text/javascript" src="'; bloginfo('url'); echo '/wp-content/themes/gallery/js/gallery.js"></script>';
  300. echo '<script type="text/javascript" src="'; bloginfo('url'); echo '/wp-content/themes/gallery/js/jquery.lazyload.pack.js"></script>';
  301.  
  302. }
  303. add_action('wp_head','fix_ie6');
  304. add_action('wp_head','gallery_slider');
  305.  
  306. // Custom post header
  307. function childtheme_post_header(){
  308.  
  309. global $childoptions;
  310. foreach ($childoptions as $childvalue) {
  311. if (get_settings( $childvalue['id'] ) === FALSE) { $$childvalue['id'] = $childvalue['std']; }
  312. else { $$childvalue['id'] = get_settings( $childvalue['id'] ); }
  313. }
  314.  
  315. if($gall_newlength){
  316. $time = $gall_newlength;
  317. } else {
  318. $time = 3;
  319. }
  320.  
  321. if ( (time()-get_the_time('U')) <= ($time*86400) ) { // The number 3 is how many days to keep posts marked as new
  322. echo '<div class="new"></div>';
  323. }
  324. }
  325.  
  326. /*
  327. Plugin Name: Custom Write Panel
  328. Plugin URI: http://wefunction.com/2008/10/tutorial-create-custom-write-panels-in-wordpress
  329. Description: Allows custom fields to be added to the WordPress Post Page
  330. Version: 1.0
  331. Author: Spencer
  332. Author URI: http://wefunction.com
  333. /* ----------------------------------------------*/
  334.  
  335. $new_meta_boxes =
  336. array(
  337. "full-image" => array(
  338. "name" => "full-image",
  339. "std" => "",
  340. "title" => "Path to Full-Size Image (500x375)",
  341. "description" => "Using the \"<em>Add an Image</em>\" button, upload a 500x375 image and paste the URL here."),
  342. "thumbnail" => array(
  343. "name" => "thumbnail",
  344. "std" => "",
  345. "title" => "Path to Thumbnail Image (125x125)",
  346. "description" => "Using the \"<em>Add an Image</em>\" button, upload a 125x125 thumbnail image and paste the URL here."),
  347. "designed-by" => array(
  348. "name" => "designed-by",
  349. "std" => "",
  350. "title" => "Designed by",
  351. "description" => "Enter the name of the designer (if known or applicable)."),
  352. "web-url" => array(
  353. "name" => "web-url",
  354. "std" => "",
  355. "title" => "Website URL",
  356. "description" => "Enter the full website URL (if applicable).")
  357. );
  358.  
  359. function new_meta_boxes() {
  360. global $post, $new_meta_boxes;
  361.  
  362. foreach($new_meta_boxes as $meta_box) {
  363. $meta_box_value = get_post_meta($post->ID, $meta_box['name'], true);
  364.  
  365. if($meta_box_value == "")
  366. $meta_box_value = $meta_box['std'];
  367.  
  368. echo'<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';
  369.  
  370. echo'<label style="font-weight: bold; display: block; padding: 5px 0 2px 2px" for="'.$meta_box['name'].'">'.$meta_box['title'].'</label>';
  371.  
  372. echo'<input type="text" name="'.$meta_box['name'].'" value="'.$meta_box_value.'" size="55" /><br />';
  373.  
  374. echo'<p><label for="'.$meta_box['name'].'">'.$meta_box['description'].'</label></p>';
  375. }
  376. }
  377.  
  378. function create_meta_box() {
  379. global $theme_name;
  380. if ( function_exists('add_meta_box') ) {
  381. add_meta_box( 'new-meta-boxes', 'Gallery Post Settings', 'new_meta_boxes', 'post', 'normal', 'high' );
  382. }
  383. }
  384.  
  385. function save_postdata( $post_id ) {
  386. global $post, $new_meta_boxes;
  387.  
  388. foreach($new_meta_boxes as $meta_box) {
  389. // Verify
  390. if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) {
  391. return $post_id;
  392. }
  393.  
  394. if ( 'page' == $_POST['post_type'] ) {
  395. if ( !current_user_can( 'edit_page', $post_id ))
  396. return $post_id;
  397. } else {
  398. if ( !current_user_can( 'edit_post', $post_id ))
  399. return $post_id;
  400. }
  401.  
  402. $data = $_POST[$meta_box['name']];
  403.  
  404. if(get_post_meta($post_id, $meta_box['name']) == "")
  405. add_post_meta($post_id, $meta_box['name'], $data, true);
  406. elseif($data != get_post_meta($post_id, $meta_box['name'], true))
  407. update_post_meta($post_id, $meta_box['name'], $data);
  408. elseif($data == "")
  409. delete_post_meta($post_id, $meta_box['name'], get_post_meta($post_id, $meta_box['name'], true));
  410. }
  411. }
  412.  
  413. add_action('admin_menu', 'create_meta_box');
  414. add_action('save_post', 'save_postdata');
  415.  
  416.  
  417.  
  418.  
  419. // Theme Options
  420.  
  421. $childthemename = "Gallery";
  422. $childshortname = "gall";
  423. $childoptions = array();
  424.  
  425. function gallery_options() {
  426. global $childthemename, $childshortname, $childoptions;
  427.  
  428. $childoptions = array (
  429.  
  430. array( "name" => "Number of Days to Keep Posts as New",
  431. "desc" => "Select a number of days to keep posts as new.",
  432. "id" => $childshortname."_newlength",
  433. "std" => "3",
  434. "type" => "text")
  435.  
  436. );
  437. }
  438. add_action('init', 'gallery_options');
  439.  
  440. // Make a Theme Options Page
  441.  
  442. function childtheme_add_admin() {
  443.  
  444. global $childthemename, $childshortname, $childoptions;
  445.  
  446. if ( $_GET['page'] == basename(__FILE__) ) {
  447.  
  448. if ( 'save' == $_REQUEST['action'] ) {
  449.  
  450. foreach ($childoptions as $childvalue) {
  451. update_option( $childvalue['id'], $_REQUEST[ $childvalue['id'] ] ); }
  452.  
  453. foreach ($childoptions as $childvalue) {
  454. if( isset( $_REQUEST[ $childvalue['id'] ] ) ) { update_option( $childvalue['id'], $_REQUEST[ $childvalue['id'] ] ); } else { delete_option( $childvalue['id'] ); } }
  455.  
  456. header("Location: themes.php?page=functions.php&saved=true");
  457. die;
  458.  
  459. } else if( 'reset' == $_REQUEST['action'] ) {
  460.  
  461. foreach ($childoptions as $childvalue) {
  462. delete_option( $childvalue['id'] ); }
  463.  
  464. header("Location: themes.php?page=functions.php&reset=true");
  465. die;
  466.  
  467. }
  468. }
  469.  
  470. add_theme_page($childthemename." Options", "$childthemename Options", 'edit_themes', basename(__FILE__), 'childtheme_admin');
  471.  
  472. }
  473.  
  474. function childtheme_admin() {
  475.  
  476. global $childthemename, $childshortname, $childoptions;
  477.  
  478. if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$childthemename.' settings saved.</strong></p></div>';
  479. if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$childthemename.' settings reset.</strong></p></div>';
  480.  
  481. ?>
  482. <div class="wrap">
  483. <h2><?php echo $childthemename; ?> Options</h2>
  484.  
  485. <form method="post">
  486.  
  487. <table class="form-table">
  488.  
  489. <?php foreach ($childoptions as $childvalue) {
  490.  
  491. switch ( $childvalue['type'] ) {
  492. case 'text':
  493. ?>
  494. <tr valign="top">
  495. <th scope="row"><?php echo $childvalue['name']; ?>:</th>
  496. <td>
  497. <input name="<?php echo $childvalue['id']; ?>" id="<?php echo $childvalue['id']; ?>" type="<?php echo $childvalue['type']; ?>" value="<?php if ( get_settings( $childvalue['id'] ) != "") { echo get_settings( $childvalue['id'] ); } else { echo $childvalue['std']; } ?>" />
  498. <?php echo $childvalue['desc']; ?>
  499. </td>
  500. </tr>
  501. <?php
  502. break;
  503.  
  504. case 'select':
  505. ?>
  506. <tr valign="top">
  507. <th scope="row"><?php echo $childvalue['name']; ?>:</th>
  508. <td>
  509. <select name="<?php echo $childvalue['id']; ?>" id="<?php echo $childvalue['id']; ?>">
  510. <?php foreach ($childvalue['options'] as $option) { ?>
  511. <option<?php if ( get_settings( $childvalue['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $childvalue['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option>
  512. <?php } ?>
  513. </select>
  514. <?php echo $childvalue['desc']; ?>
  515. </td>
  516. </tr>
  517. <?php
  518. break;
  519.  
  520. case 'textarea':
  521. $ta_options = $childvalue['options'];
  522. ?>
  523. <tr valign="top">
  524. <th scope="row"><?php echo $childvalue['name']; ?>:</th>
  525. <td>
  526. <?php echo $childvalue['desc']; ?>
  527. <textarea name="<?php echo $childvalue['id']; ?>" id="<?php echo $childvalue['id']; ?>" cols="<?php echo $ta_options['cols']; ?>" rows="<?php echo $ta_options['rows']; ?>"><?php
  528. if( get_settings($childvalue['id']) != "") {
  529. echo stripslashes(get_settings($childvalue['id']));
  530. }else{
  531. echo $childvalue['std'];
  532. }?></textarea>
  533. </td>
  534. </tr>
  535. <?php
  536. break;
  537.  
  538. case "radio":
  539. ?>
  540. <tr valign="top">
  541. <th scope="row"><?php echo $childvalue['name']; ?>:</th>
  542. <td>
  543. <?php foreach ($childvalue['options'] as $key=>$option) {
  544. $radio_setting = get_settings($childvalue['id']);
  545. if($radio_setting != ''){
  546. if ($key == get_settings($childvalue['id']) ) {
  547. $checked = "checked=\"checked\"";
  548. } else {
  549. $checked = "";
  550. }
  551. }else{
  552. if($key == $childvalue['std']){
  553. $checked = "checked=\"checked\"";
  554. }else{
  555. $checked = "";
  556. }
  557. }?>
  558. <input type="radio" name="<?php echo $childvalue['id']; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?> /><?php echo $option; ?><br />
  559. <?php } ?>
  560. </td>
  561. </tr>
  562. <?php
  563. break;
  564.  
  565. case "checkbox":
  566. ?>
  567. <tr valign="top">
  568. <th scope="row"><?php echo $childvalue['name']; ?>:</th>
  569. <td>
  570. <?php
  571. if(get_settings($childvalue['id'])){
  572. $checked = "checked=\"checked\"";
  573. }else{
  574. $checked = "";
  575. }
  576. ?>
  577. <input type="checkbox" name="<?php echo $childvalue['id']; ?>" id="<?php echo $childvalue['id']; ?>" value="true" <?php echo $checked; ?> />
  578. <?php ?>
  579. <?php echo $childvalue['desc']; ?>
  580. </td>
  581. </tr>
  582. <?php
  583. break;
  584.  
  585. default:
  586.  
  587. break;
  588. }
  589. }
  590. ?>
  591.  
  592. </table>
  593.  
  594. <p class="submit">
  595. <input name="save" type="submit" value="Save changes" />
  596. <input type="hidden" name="action" value="save" />
  597. </p>
  598. </form>
  599. <form method="post">
  600. <p class="submit">
  601. <input name="reset" type="submit" value="Reset" />
  602. <input type="hidden" name="action" value="reset" />
  603. </p>
  604. </form>
  605.  
  606. <p><?php _e('For more information about this theme, <a href="http://themeshaper.com">visit ThemeShaper</a>. If you have any questions, visit the <a href="http://themeshaper.com/forums/">ThemeShaper Forums</a>.', 'thematic'); ?></p>
  607.  
  608. <?php
  609. }
  610.  
  611. add_action('admin_menu' , 'childtheme_add_admin');
  612.  
  613. ?>
RAW Paste Data