/i', $post->post_content, $matches)){ $first_img = $matches [1] [0]; } return $first_img; } /** * Declare Variables */ $themename = "dasthemes"; $shortname = "dt"; $categories = get_categories('hide_empty=0&orderby=name'); $all_cats = array(); foreach ($categories as $category_item ) { $all_cats[$category_item->cat_ID] = $category_item->cat_name; } array_unshift($all_cats, "Select a category"); /** * register settings */ function theme_settings_init(){ register_setting( 'theme_settings', 'theme_settings' ); } /** * add settings page to menu */ function add_theme_page() { add_theme_page( __( 'Theme Panel' .'howl-themes' ), __( 'Theme' .'howl-themes' ), 'manage_options', 'settings', 'theme_settings_page'); } /** * add actions */ add_action( 'admin_init', 'theme_settings_init' ); add_action( 'admin_menu', 'add_theme_page' ); /** * Declare Option */ $theme_options = array ( array( "name" => $themename." Options", "type" => "title"), /** * Homepage Builder */ array( "name" => "LabelSep", "type" => "section"), array( "type" => "open"), array( "name" => "countlin", "desc" => "save li count", "id" => $shortname."_howlimany", "type" => "text", "std" => ""), array( "name" => "rembembertname", "desc" => "remember the name", "id" => $shortname."_rembertname", "type" => "text", "std" => ""), array( "name" => "remebertcat", "desc" => "remember the cat", "id" => $shortname."_rembertcat", "type" => "text", "std" => ""), array( "name" => "remembertli", "desc" => "remember the li", "id" => $shortname."_remembertli", "type" => "text", "std" => ""), array( "name" => "Upload Logo", "desc" => "Enter the link to your logo image", "id" => $shortname."_logo", "type" => "upload", "std" => ""), array( "name" => "Custom Favicon", "desc" => "A favicon is a 16x16 pixel icon that represents your site", "id" => $shortname."_favicon", "type" => "upload", "std" => home_url('url') ."/images/favicon.ico"), array( "name" => "Home Page Display", "id" => $shortname."_homedisplay", "type" => "text", "std" => ""), array( "name" => "Home Page Layout", "id" => $shortname."_homelayout", "type" => "text", "std" => ""), array( "type" => "close"), array( "name" => "Styling", "type" => "section"), array( "type" => "open"), array( "name" => "Background Color", "desc" => "Choose the color for your site background", "id" => $shortname."_backcolor", "type" => "color", "std" => ""), array( "name" => "Background Image", "desc" => "Change background image using upload button", "id" => $shortname."_backimg", "type" => "upload", "std" => ""), array( "name" => "Theme Primary Color", "desc" => "Change the Primary Color of your theme", "id" => $shortname."_themecolor", "type" => "color", "std" => ""), array( "name" => "Link Color", "desc" => "Choose the color for links", "id" => $shortname."_linkcolor", "type" => "color", "std" => ""), array( "name" => "Link Color:onHover", "desc" => "Which color you want link to show when users puts mouse on it", "id" => $shortname."_linkhovercolor", "type" => "color", "std" => ""), array( "type" => "close"), array( "name" => "Typography", "type" => "section"), array( "type" => "open"), array( "name" => "Fonts ID", "id" => $shortname."_fontid", "type" => "text", "std" => ""), array( "name" => "Fonts Name", "id" => $shortname."_fontname", "type" => "text", "std" => ""), array( "name" => "Post Font Color", "desc" => "Choose the color for Text which display inside container", "id" => $shortname."_bodycolor", "type" => "color", "std" => ""), array( "name" => "Post Font Size", "desc" => "To change font size, just edit the integer, eg: 20px", "id" => $shortname."_bfontsize", "type" => "text", "std" => "18px"), array( "type" => "close"), array( "name" => "Social", "type" => "section"), array( "type" => "open"), array( "name" => "Facebook", "desc" => "Enter Facebook Page URL", "id" => $shortname."_fbpageurl", "type" => "text", "std" => ""), array( "name" => "Twitter", "desc" => "Enter Twitter Page URL", "id" => $shortname."_twpageurl", "type" => "text", "std" => ""), array( "name" => "Google Plus", "desc" => "Enter Google+ Page URL", "id" => $shortname."_gopageurl", "type" => "text", "std" => ""), array( "name" => "Pinterest", "desc" => "Enter Pinterest Profile URL", "id" => $shortname."_pinteresturl", "type" => "text", "std" => ""), array( "name" => "Instagram", "desc" => "Enter Instagram Profile URL", "id" => $shortname."_instagramurl", "type" => "text", "std" => ""), array( "name" => "Linkedin", "desc" => "Enter Linkedin Profile URL", "id" => $shortname."_linkedinurl", "type" => "text", "std" => ""), array( "name" => "YouTube", "desc" => "Enter YouTube Channel URL", "id" => $shortname."_youtubeurl", "type" => "text", "std" => ""), array( "name" => "RSS", "desc" => "Enter Feedburner URL of your blog", "id" => $shortname."_rssurl", "type" => "text", "std" => ""), array( "type" => "close"), array( "name" => "Advertisment", "type" => "section"), array( "type" => "open"), array( "name" => "720X90 Ads Code (Below Header)", "desc" => "You can add custom ads code or adsense ads code, it will display below header. I will suggest you to use responsive adsense ads code.", "id" => $shortname."_custom_ads_header", "type" => "textarea", "std" => ""), array( "name" => "Ads Code (Above Comment)", "desc" => "This ad will only display in post page above comment form, You can add custom ads code or adsense ads code. I will suggest you to use responsive adsense ads code.", "id" => $shortname."_custom_ads_abovecmt", "type" => "textarea", "std" => ""), array( "name" => "Ads Code (Below Post Title)", "desc" => "This ad will only display in post page, You can add custom ads code or adsense ads code. I will suggest you to use responsive adsense ads code.", "id" => $shortname."_custom_ads_post", "type" => "textarea", "std" => ""), array( "type" => "close"), array( "name" => "fordev", "type" => "section"), array( "type" => "open"), array( "name" => "Custom Css Code", "desc" => "Want to add any custom CSS code? Put in here, and the rest is taken care of.", "id" => $shortname."_custom_css", "type" => "textarea", "std" => ""), array( "name" => "Head Code", "desc" => "Just paste below any script or css stylesheet you want to add to your site", "id" => $shortname."_custom_head", "type" => "textarea", "std" => ""), array( "name" => "Footer Code", "desc" => "Anything pasted in below textbox will be added in theme footer, use it if you know what you are doing. Else any wrong code can give hacker chance to hack your blog.", "id" => $shortname."_custom_foot", "type" => "textarea", "std" => ""), array( "type" => "close"), ); /** * Theme Panel Output */ function theme_settings_page() { global $themename,$theme_options; $i=0; $message=''; if ( 'save' == isset($_REQUEST['action']) ) { foreach ($theme_options as $value) { if(isset($value['id'])){ update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } } foreach ($theme_options as $value) { if(isset($value['id'])){ if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } } $message='saved'; } } else if( 'reset' == isset($_REQUEST['action'] )) { foreach ($theme_options as $value) { delete_option( $value['id'] ); } $message='reset'; } ?>
'; if ( $message=='reset' ) echo ''.$themename.' settings reset.