";
echo $ret;
die();
}
if ( ! function_exists( 'soundmap_theme_setup' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* To override soundmap_theme_setup() in a child theme, add your own soundmap_theme_setup to your child theme's
* functions.php file.
*
* @uses load_theme_textdomain() For translation/localization support.
* @uses add_editor_style() To style the visual editor.
* @uses add_theme_support() To add support for post thumbnails, automatic feed links, and Post Formats.
* @uses register_nav_menus() To add support for navigation menus.
* @uses add_custom_background() To add support for a custom background.
* @uses add_custom_image_header() To add support for a custom header.
* @uses register_default_headers() To register the default custom header images provided with the theme.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
*
* @since Twenty Eleven 1.0
*/
function soundmap_theme_setup() {
/* Make Twenty Eleven available for translation.
* Translations can be added to the /languages/ directory.
* If you're building a theme based on Twenty Eleven, use a find and replace
* to change 'soundmap_theme' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'soundmap_theme', TEMPLATEPATH . '/languages' );
$locale = get_locale();
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
if ( is_readable( $locale_file ) )
require_once( $locale_file );
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style();
add_theme_support('post-thumbnails');
// Add default posts and comments RSS feed links to .
add_theme_support( 'automatic-feed-links' );
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'primary', __( 'Primary Menu', 'soundmap_theme' ) );
// Add support for a variety of post formats
add_theme_support( 'post-formats', array( 'link' ) );
}
endif; // soundmap_theme_setup
add_filter('wp_get_nav_menu_items','soundmap_theme_menu_modify_upload');
function soundmap_theme_menu_modify_upload( $items){
foreach ($items as $item) {
if ($item->xfn=='addnewfile'){
$item->url = insert_upload_form(__("Upload recording","soundmap_theme"),false);
$item->classes[]='thickbox';
}
}
return $items;
}
/**
* Sets the post excerpt length to 40 words.
*
* To override this length in a child theme, remove the filter and add your own
* function tied to the excerpt_length filter hook.
*/
function soundmap_theme_excerpt_length( $length ) {
return 40;
}
//add_filter( 'excerpt_length', 'soundmap_theme_excerpt_length' );
/**
* Returns a "Continue Reading" link for excerpts
*/
function soundmap_theme_continue_reading_link() {
return ' ' . __( 'Continue reading →', 'soundmap_theme' ) . '';
}
/**
* Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and soundmap_theme_continue_reading_link().
*
* To override this in a child theme, remove the filter and add your own
* function tied to the excerpt_more filter hook.
*/
function soundmap_theme_auto_excerpt_more( $more ) {
return ' …' . soundmap_theme_continue_reading_link();
}
add_filter( 'excerpt_more', 'soundmap_theme_auto_excerpt_more' );
/**
* Adds a pretty "Continue Reading" link to custom post excerpts.
*
* To override this link in a child theme, remove the filter and add your own
* function tied to the get_the_excerpt filter hook.
*/
function soundmap_theme_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= soundmap_theme_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'soundmap_theme_custom_excerpt_more' );
/**
* Register our sidebars and widgetized areas. Also register the default Epherma widget.
*
* @since Twenty Eleven 1.0
*/
function soundmap_theme_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Sidebar', 'soundmap_theme' ),
'id' => 'sidebar-1',
'before_widget' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer Area ', 'soundmap_theme' ),
'id' => 'sidebar-footer',
'description' => __( 'An optional widget area for your site footer', 'soundmap_theme' ),
'before_widget' => '",
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer Area Three', 'soundmap_theme' ),
'id' => 'sidebar-5',
'description' => __( 'An optional widget area for your site footer', 'soundmap_theme' ),
'before_widget' => '",
'before_title' => '
',
'after_title' => '
',
) );
register_widget('WP_Widget_Extended_Links');
}
add_action( 'widgets_init', 'soundmap_theme_widgets_init' );
//add_filter( 'wp_nav_menu_items', 'soundmap_theme_add_search_box', 10, 2 );
function soundmap_theme_add_search_box ( $items, $args ) {
// only on primary menu
ob_start();
get_search_form();
$searchform = ob_get_contents();
ob_end_clean();
$items .= '
' . $searchform . '
';
return $items;
}
function soundmap_theme_options_init() {
// If we have no options in the database, let's add them now.
if ( false === soundmap_theme_get_theme_options() )
add_option( 'soundmap_theme_options', soundmap_theme_get_default_theme_options() );
register_setting(
'soundmap_theme', // Options group, see settings_fields() call in theme_options_render_page()
'soundmap_theme_options', // Database option, see soundmap_theme_get_theme_options()
'soundmap_theme_options_validate' // The sanitization callback, see soundmap_theme_theme_options_validate()
);
}
function soundmap_theme_get_theme_options() {
return get_option( 'soundmap_theme_options', soundmap_theme_get_default_theme_options() );
}
function soundmap_theme_get_default_theme_options() {
$default_theme_options = array(
'main-pages' => '0',
);
return $default_theme_options;
}
function soundmap_theme_options_render_page() {
?>