$options['footer'], 'address' => '
455 Larkspur Dr. California Springs, CA 92926
' . "\n" . '
phone:
+1 (707)
123-45-67
' . "\n" . '
' . "\n" . '© [blog name]', 'contact_me_via_email' => '
Contact me by
' . "\n" . '
email:
[admin_email]
' . "\n" . '
' . "\n" . '© [blog name]', 'contact_me_via_contact_form' => '
Contact me via
' . "\n" . '
Contact Form
' . "\n" . '
' . "\n" . '© [blog name]', 'general_info' => '
MySite.com
' . "\n" . '
[blog name]
' . "\n" . '
' . "\n" . '[blog description]', ); class AestheteOptions { function getOptions() { $options = get_option('aesthete_options'); if (!is_array($options)) { $options = array ( 'portfolio_category'=> '', 'portfolio_works_per_page'=> 10, 'portfolio_thumb_width'=> 190, 'portfolio_thumb_height'=> 143, 'catalogue_category'=>'', 'catalogue_thumb_width'=> 100, 'catalogue_thumb_height'=> 100, 'catalogue_items_per_page'=> 10, 'hide_post_info'=> false, 'catalogue_image_number'=>1, 'use_graph_header'=>false, 'footer'=>'
MySite.com
[blog name]
[blog description]', 'top_menu' =>'' ); update_option('aesthete_options', $options); } return $options; } function add() { if(isset($_POST['aesthete_save_options'])) { $options = AestheteOptions::getOptions(); // meta $options['portfolio_category'] = stripslashes($_POST['portfolio_category']); $options['top_menu'] = stripslashes($_POST['top_menu']); $options['portfolio_works_per_page'] = (int)($_POST['portfolio_works_per_page']); $options['portfolio_thumb_width'] = (int)($_POST['portfolio_thumb_width']); $options['portfolio_thumb_height'] = (int)($_POST['portfolio_thumb_height']); $options['catalogue_category'] = stripslashes($_POST['catalogue_category']); $options['catalogue_thumb_width'] = (int)($_POST['catalogue_thumb_width']); $options['catalogue_thumb_height'] = (int)($_POST['catalogue_thumb_height']); $options['catalogue_image_number'] = (int)($_POST['catalogue_image_number']); $options['catalogue_items_per_page'] = (int)($_POST['catalogue_items_per_page']); $options['hide_post_info'] = ($_POST['hide_post_info'])?true:false; $options['use_graph_header'] = ($_POST['use_graph_header'])?true:false; $options['footer'] = stripslashes($_POST['aestheteFooter']); update_option('aesthete_options', $options); } else { AestheteOptions::getOptions(); } add_theme_page("Aesthete Theme Options", "Aesthete Theme Options", 'edit_themes', basename(__FILE__), array('AestheteOptions', 'display')); } function option_footer_templates() { global $aestheteFooterTemplates; $options = get_option('aesthete_options'); foreach ($aestheteFooterTemplates as $k=>$v) { echo ''; } } function test_php_thumb_cache() { $fc=''; $message =''; $thumbCache = $_SERVER['DOCUMENT_ROOT'].'/phpThumb/cache'; if (!is_writable($thumbCache)) { $cacheDir=get_option( 'upload_path' ).'/phpThumbCache'; if (!is_dir($cacheDir)) { if (!is_dir(get_option( 'upload_path' ))) @mkdir(get_option( 'upload_path' ), 0777); $rs = @mkdir($cacheDir, 0777); } if (!is_writable($cacheDir)) { //if (!@chmod($cacheDir, 0777)) { //$message = "The dir is not writable: $cacheDir"; $cacheDir = get_option( 'upload_path' ); if (!is_writable($cacheDir)) { if ( is_file($_SERVER['DOCUMENT_ROOT'].'/phpThumb/phpThumb.config.php')) $fc = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/phpThumb/phpThumb.config.php'); if (!preg_match('`^[^\/]*\$PHPTHUMB_CONFIG\[\'cache_directory\'\] = null;.*$`m',$fc,$m)) { $message = "

Thumbnailing does not work

" . "To use thumbnailing you need EITHER to set write permissions (0777) to the dir
$thumbCache or
$cacheDir
" . "OR disable thumbnail caching:
" . "
  1. Open file ".$_SERVER['DOCUMENT_ROOT'].'/phpThumb/phpThumb.config.php'."
  2. " . "
  3. Find line containing //\$PHPTHUMB_CONFIG['cache_directory'] = null; (it must be line 38)
  4. " . "
  5. Uncomment the line
  6. " . "
  7. Save the file
"; } } } } if (is_writable($cacheDir)) { if ( is_file($_SERVER['DOCUMENT_ROOT'].'/phpThumb/phpThumb.config.php')) $fc = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/phpThumb/phpThumb.config.php'); $s = '`^[^/]*\$PHPTHUMB_CONFIG\[\'cache_directory\'\] = \''.addcslashes($cacheDir,'\'\\-"[]()+$*').'\'.*$`m'; if (!preg_match($s,$fc,$m)) { $message = "

Thumbnailing does not work

" . "To use thumbnailing you need to modify file ".$_SERVER['DOCUMENT_ROOT'].'/phpThumb/phpThumb.config.php'." :
" . "
  1. Find the line containing \$PHPTHUMB_CONFIG['cache_directory'] = dirname(__FILE__).'/cache/'; (must be line 35)
  2. " . "
  3. Comment the line
  4. " . "
  5. Add after it the following line:
    " . "\$PHPTHUMB_CONFIG['cache_directory'] = '$cacheDir';
"; } } } return $message; } function display() { global $aestheteFooterTemplates; $options = AestheteOptions::getOptions(); $message =AestheteOptions::test_php_thumb_cache(); if ($message) $message = '
'.$message.'
'; ?>

Aesthete theme options

Portfolio Category Category ID containing portfolio works
Portfolio Thumb Width
Portfolio Thumb Height
Portfolio Works Per Page
Catalogue Category Category ID containing goods description
Catalogue Thumb Width
Catalogue Thumb Height
Number of preview images per catalogue item in list
Catalogue items per page
Hide Post Info "> Check it if you want to hide post info (date, edit link, categories and tags). Can be usefull if you use wordpress for a corporate site
Use Graphic Header "> This option turns on graphic header. Please read README on this option.
Footer
select a predefined template and edit it


You can use following shortcodes:
[blog name]
[blog description]
[blog home]
[admin_email] Antispam encoded
[email your@email.com] Antispam encoded

Footer preview

cat_ID).'">'.$category->name.''; } $category_list = get_category_parents($categories[0]->cat_ID, TRUE, $delimiter); $category_list =substr($category_list,0, strrpos($category_list,$delimiter)); $category_list =substr($category_list,0, strrpos($category_list,$delimiter)); if ($category_list) $out = $category_list . $delimiter . $out; } return $out; } /* @param $post_id int @param $category int определяет, находится ли пост в заданной корневой категории */ function in_root_category($post_id, $root_category_id='') { $categories = &get_the_category($post_id); if (is_array($categories)) { foreach ($categories as $category) { if ($root_category_id == get_root_category($category->cat_ID)) return true; } } return false; } /* returns category IDs of the post separated by comma */ function get_post_categories_list($post_id) { $categories = &get_the_category($post_id); $out=''; foreach ($categories as $category) { if ($out) $out .= ', '; $out .= $category->cat_ID; } return $out; } function get_post_category_names_list($post_id) { $categories = &get_the_category($post_id); $out=''; foreach ($categories as $category) { if ($out) $out .= ', '; $out .= $category->name; } return $out; } function get_post_root_category($post_id) { $categories = &get_the_category($post_id); if (is_array($categories)) { foreach ($categories as $category_id) { return get_root_category($category_id); } } return false; } function get_root_category($category_id='') { $category = &get_category( $category_id ); if ($category->parent) { $parent_id = get_root_category($category->parent); //echo "+"; print_r($parent); return $parent_id; } else return $category_id; } function post_has_immage($post) { return (bool)preg_match('//i', $post->post_content); } // не проверялась! function catch_that_image() { global $post; $first_img = ''; $output = preg_match_all('//i', $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){ //определяем картинку по умолчанию $first_img = "/images/default.jpg"; } return $first_img; } // custom comments function mytheme_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; //print_r($comment); ?>
  • id="comment-">
    comment_approved == '0') : ?>
    $depth, 'max_depth' => $args['max_depth']))) ?>
    var m=' . $js_email .';' . 'document.write(\'\'+' . (($text)?'\''.$text.'\'':'m') . '+\'\');'; return $js; } function get_tags_for_post($post_id, $type='post_tag') { $tags = get_the_terms($post_id,$type); $tag_list=''; if (is_array($tags)) foreach ($tags as $tag) $tag_list .= ' '.$tag->name; return $tag_list; } function fix_caption_width($x=null, $attr, $content) { $xs= 8; //add 8px to image width extract(shortcode_atts(array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '' ), $attr)); if ( 1 > (int) $width || empty($caption) ) { return $content; } if ( $id ) $id = 'id="' . $id . '" '; return '
    ' . $content . '

    ' . $caption . '

    '; } // #######################################################################################3 function draw_image_thumb($args) { global $post; $defaults = array( 'max_width' => 700, 'max_height' => 700, 'caption' => false, 'align'=>'alignnone', 'link_to' => 'post', 'thumb_only'=>false, 'fit_entire_size'=>true, 'img'=>null, 'margin'=>false, 'aclass'=>'agallery wp-caption', 'padding'=>4, ); $r = wp_parse_args( $args, $defaults ); $awidth = $r['max_width']; $aheight = $r['max_height']; if ($r['caption']) $aheight +=22; $pad=$r['padding']; //padding; if ($r['img']) $img =$r['img']; else { $args = array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => image, 'order' => 'ASC', 'orderby' => 'menu_order ID' ); $images =& get_children( $args ); if (($images)) { $found_thumb=false; foreach ( $images as $attachment_id => $attachment ) { if (preg_match('/thumb/i',$attachment->post_name)) { $found_thumb=true; $img = wp_get_attachment_image_src( $attachment_id,'full'); break; } } if (!$found_thumb && !$thumb_only) { foreach ( $images as $attachment_id => $attachment ) { $img = wp_get_attachment_image_src( $attachment_id,'full'); break; } } } else return; } $h = round(min($img[2]*$r['max_width']/$img[1],$r['max_height'])); $w = round(min($img[1]*$h/$img[2],$r['max_width'])); //echo "h=$h, w=$w "; $img_url = substr($img[0], 7+strlen($_SERVER['SERVER_NAME'])); ?> ID?>]"':'')?> class=" " title="" style="width: px; height:px; ">

    post_excerpt?>

    get_bloginfo('name'), '[blog description]' => get_bloginfo('description'), '[blog home]' => get_option('home'), '[admin_email]' => hide_email(get_bloginfo('admin_email')), ); $footer = $options['footer']; foreach ($shortcodes as $k => $v) { $footer = str_replace($k, $v, $footer); } preg_match_all('/\[email (.*)\]/',$footer, $matches); if (is_array($matches)) foreach ($matches[0] as $k=>$v) { $footer = str_replace($v,hide_email($matches[1][$k]), $footer); } return $footer; } /**************************************************** START *****************************************************/ if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) { echo "message"; } add_filter('img_caption_shortcode', 'fix_caption_width', 10, 3); add_filter( 'comments_template', 'legacy_comments' ); add_action ('init', 'theme_init'); add_action('admin_menu', array('AestheteOptions', 'add')); if( function_exists('register_sidebar') ) { register_sidebar(array( 'name' => 'index_sidebar', 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ' )); }