Skip to content

Commit

Permalink
Cousin of the Thematic Options Panel. First commit attempt.
Browse files Browse the repository at this point in the history
  • Loading branch information
devinsays committed Dec 18, 2010
0 parents commit 71cede3
Show file tree
Hide file tree
Showing 48 changed files with 3,837 additions and 0 deletions.
63 changes: 63 additions & 0 deletions footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
/**
* The template for displaying the footer.
*
* Contains the closing of the id=main div and all content
* after. Calls sidebar-footer.php for bottom widgets.
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
?>
</div><!-- #main -->

<div id="footer" role="contentinfo">
<div id="colophon">

<?php
/* A sidebar in the footer? Yep. You can can customize
* your footer with four columns of widgets.
*/
get_sidebar( 'footer' );
?>

<div id="site-info">
<?php /* Replace default text if option is set */
if( get_option('of_footer_left') == 'true'){
echo get_option('of_footer_left_text');
} else {
?>
<a href="<?php echo home_url( '/' ) ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
<?php } ?>
</div><!-- #site-info -->

<?php if( get_option('of_footer_right') == 'true'){ ?>
<div id="footer-right-side">
<?php echo get_option('of_footer_right_text'); ?>
</div> <!-- #footer-right-side -->
<?php } else { ?>
<div id="site-generator">
<?php do_action( 'twentyten_credits' ); ?>
<a href="<?php echo esc_url( __('http://wordpress.org/', 'twentyten') ); ?>"
title="<?php esc_attr_e('Semantic Personal Publishing Platform', 'twentyten'); ?>" rel="generator">
<?php printf( __('Proudly powered by %s.', 'twentyten'), 'WordPress' ); ?>
</a>
</div><!-- #site-generator -->
<?php } ?>

</div><!-- #colophon -->
</div><!-- #footer -->

</div><!-- #wrapper -->

<?php
/* Always have wp_footer() just before the closing </body>
* tag of your theme, or you will break many plugins, which
* generally use this hook to reference JavaScript files.
*/

wp_footer();
?>
</body>
</html>
27 changes: 27 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/*-----------------------------------------------------------------------------------*/
/* Options Framework Functions
/*-----------------------------------------------------------------------------------*/

/* Set the file path based on whether the Options Framework is in a parent theme or child theme */

if ( STYLESHEETPATH == TEMPLATEPATH ) {
define('OF_FILEPATH', TEMPLATEPATH);
define('OF_DIRECTORY', get_bloginfo('template_directory'));
} else {
define('OF_FILEPATH', STYLESHEETPATH);
define('OF_DIRECTORY', get_bloginfo('stylesheet_directory'));
}

/* These files build out the options interface. Likely won't need to edit these. */

require_once (OF_FILEPATH . '/functions/admin-functions.php'); // Custom functions and plugins
require_once (OF_FILEPATH . '/functions/admin-interface.php'); // Admin Interfaces (options,framework, seo)

/* These files build out the theme specific options and associated functions. */

require_once (OF_FILEPATH . '/functions/theme-options.php'); // Options panel settings and custom settings
require_once (OF_FILEPATH . '/functions/theme-functions.php'); // Theme actions based on options settings

?>
89 changes: 89 additions & 0 deletions functions/admin-functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php

/*-----------------------------------------------------------------------------------*/
/* Head Hook
/*-----------------------------------------------------------------------------------*/

function of_head() { do_action( 'of_head' ); }

/*-----------------------------------------------------------------------------------*/
/* Get the style path currently selected */
/*-----------------------------------------------------------------------------------*/

function of_style_path() {
$style = $_REQUEST['style'];
if ($style != '') {
$style_path = $style;
} else {
$stylesheet = get_option('of_alt_stylesheet');
$style_path = str_replace(".css","",$stylesheet);
}
if ($style_path == "default")
echo 'images';
else
echo 'styles/'.$style_path;
}

/*-----------------------------------------------------------------------------------*/
/* Add default options after activation */
/*-----------------------------------------------------------------------------------*/
if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
//Call action that sets
add_action('admin_head','of_option_setup');
}

function of_option_setup(){

//Update EMPTY options
$of_array = array();
add_option('of_options',$of_array);

$template = get_option('of_template');
$saved_options = get_option('of_options');

foreach($template as $option) {
if($option['type'] != 'heading'){
$id = $option['id'];
$std = $option['std'];
$db_option = get_option($id);
if(empty($db_option)){
if(is_array($option['type'])) {
foreach($option['type'] as $child){
$c_id = $child['id'];
$c_std = $child['std'];
update_option($c_id,$c_std);
$of_array[$c_id] = $c_std;
}
} else {
update_option($id,$std);
$of_array[$id] = $std;
}
}
else { //So just store the old values over again.
$of_array[$id] = $db_option;
}
}
}
update_option('of_options',$of_array);
}

/*-----------------------------------------------------------------------------------*/
/* Admin Backend */
/*-----------------------------------------------------------------------------------*/
function optionsframework_admin_head() {

//Tweaked the message on theme activate
?>
<script type="text/javascript">
jQuery(function(){
var message = '<p>This theme comes with an <a href="<?php echo admin_url('admin.php?page=optionsframework'); ?>">options panel</a> to configure settings. This theme also supports widgets, please visit the <a href="<?php echo admin_url('widgets.php'); ?>">widgets settings page</a> to configure them.</p>';
jQuery('.themes-php #message2').html(message);

});
</script>
<?php
}

add_action('admin_head', 'optionsframework_admin_head');

?>
Loading

0 comments on commit 71cede3

Please sign in to comment.