سلام.
تابع فانشن من:
<?php include_once 'FT/FT_scope.php'; FT_scope::init(); ?><?php
/**
* Cartel functions and definitions
*
* @package Cartel
*/
/* Custom style */
function custom_style() {
$banner_bg = ft_of_get_option('banner_background');
$blog_bg = ft_of_get_option('blog_background');
$subhead_bg = ft_of_get_option('subhead_background');
?>
<style type="text/css">
#subheader { background-image: url(<?php echo $subhead_bg ?>
; }
.home-blog { background-image: url(<?php echo $blog_bg ?>
; }
.home-banners { background-image: url(<?php echo $banner_bg ?>
; }
</style>
<?php }
add_action( 'wp_head', 'custom_style' );
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) ) {
$content_width = 640; /* pixels */
}
if ( ! function_exists( 'cartel_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function cartel_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Cartel, use a find and replace
* to change 'cartel' to the name of your theme in all the template files
*/
load_theme_textdomain( 'cartel', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link
لینک ها تنها برای اعضای سایت قابل نمایش است.
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'cartel' ),
) );
// Enable support for Post Formats.
//add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) );
// Setup the WordPress core custom background feature.
/*
add_theme_support( 'custom-background', apply_filters( 'cartel_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
*/
// Enable support for HTML5 markup.
add_theme_support( 'html5', array(
'comment-list',
'search-form',
'comment-form',
'gallery',
'caption',
) );
}
endif; // cartel_setup
add_action( 'after_setup_theme', 'cartel_setup' );
/**
* Register widget area.
*
* @link
لینک ها تنها برای اعضای سایت قابل نمایش است.
*/
function cartel_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'cartel' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '<aside id="%1$s" class="widget clear %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
));
register_sidebar( array(
'name' => __( 'Footer ', 'cartel' ),
'id' => 'footer-widget',
'description' => '',
'before_widget' => '<aside id="%1$s" class="footer-widget col-md-4 %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
));
register_sidebar( array(
'name' => __( 'Homepage ', 'cartel' ),
'id' => 'home-widget',
'description' => '',
'before_widget' => '<aside id="%1$s" class="home-widget col-sm-4 %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="home-widget-title">',
'after_title' => '</h2>',
));
}
add_action( 'widgets_init', 'cartel_widgets_init' );
/**
* Enqueue Bootstrap and FA.
*/
function add_bootstrap(){
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/bootstrap/bootstrap.css');
wp_enqueue_style( 'fontawesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css');
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/bootstrap/bootstrap.min.js', array( 'jquery' ), '20120206', true );
}
add_action( 'wp_enqueue_scripts', 'add_bootstrap' );
/* Deregister few stuff */
add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
function my_deregister_styles() {
wp_deregister_style( 'wp-pagenavi' );
wp_deregister_style( 'jquery-dropdown-cart' );
}
/* Enque theme scripts and styles */
function cartel_scripts() {
wp_enqueue_style( 'cartel-style', get_stylesheet_uri() );
wp_enqueue_style( 'bootstrap-select', get_stylesheet_directory_uri() . '/css/bootstrap-select.min.css');
wp_enqueue_style( 'flexslider', get_stylesheet_directory_uri() . '/css/flexslider.css');
wp_enqueue_style( 'woocommerce-layout', get_stylesheet_directory_uri() . '/css/woocommerce-layout.css');
wp_enqueue_style( 'woocommerce-smallscreen', get_stylesheet_directory_uri() . '/css/woocommerce-smallscreen.css', array(), '','screen and (max-width: 768px');
wp_enqueue_style( 'woocommerce', get_stylesheet_directory_uri() . '/css/woocommerce.css');
wp_enqueue_style( 'theme', get_stylesheet_directory_uri() . '/css/theme.css');
wp_enqueue_style( 'responsive', get_stylesheet_directory_uri() . '/css/responsive.css');
wp_enqueue_script( 'cartel-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
wp_enqueue_script( 'bootstrap-select', get_template_directory_uri() . '/js/bootstrap-select.min.js', array(), '20130115', true );
wp_enqueue_script( 'flexslider', get_template_directory_uri() . '/js/jquery.flexslider.js', array(), '20130115', true );
wp_enqueue_script( 'selectnav', get_template_directory_uri() . '/js/selectnav.js', array(), '20130115', true );
wp_enqueue_script( 'jshowoff', get_template_directory_uri() . '/js/jquery.jshowoff.js', array(), '20130115', true );
wp_enqueue_script( 'custom', get_template_directory_uri() . '/js/custom.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'cartel_scripts' );
/* Slide post image and link metabox */
add_action( 'admin_head', 'remove_my_meta_boxer' );
function remove_my_meta_boxer() {
remove_meta_box( 'postimagediv', 'slide', 'side' );
add_meta_box('postimagediv', __('Add a slide image'), 'post_thumbnail_meta_box', 'slide', 'advanced', 'high');
}
function add_imglink_metabox(){
add_meta_box('slidelink', 'Slide link', 'slide_link_metabox', 'slide', 'advanced', 'default');
}
add_action('add_meta_boxes', 'add_imglink_metabox');
function slide_link_metabox($post){
wp_nonce_field(plugin_basename( __FILE__ ), 'wpt_nonce');
$imglink = get_post_meta($post->ID, '_slide_link', true);
echo('<p> <input class="widefat" id="slide_link_box" name="slide_link_box" type="text"');
echo(' value="'.$imglink.'" </p>');
}
function wpt_slide_metabox($post_id){
//Can user really do this?
if(!current_user_can('edit_posts')) return;
//Do we really want this to be done?
if(!isset($_POST['wpt_nonce']) || !wp_verify_nonce($_POST['wpt_nonce'], plugin_basename(__FILE__))) return;
$slide_data = sanitize_text_field($_POST['slide_link_box']);
update_post_meta($post_id, '_slide_link', $slide_data );
}
add_action('save_post', 'wpt_slide_metabox');
/* Options fallback */
if ( !function_exists( 'ft_of_get_option' ) ) {
function ft_of_get_option($name, $default = false) {
$optionsframework_settings = get_option('optionsframework');
// Gets the unique option id
$option_name = $optionsframework_settings['id'];
if ( get_option($option_name) ) {
$options = get_option($option_name);
}
if ( isset($options[$name]) ) {
return $options[$name];
} else {
return $default;
}
}
}
/* Credits */
function selfURL() {
$uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] :
$_SERVER['PHP_SELF'];
$uri = parse_url($uri,PHP_URL_PATH);
$protocol = $_SERVER['HTTPS'] ? 'https' : 'http';
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
$server = ($_SERVER['SERVER_NAME'] == 'localhost') ?
$_SERVER["SERVER_ADDR"] : $_SERVER['SERVER_NAME'];
return $protocol."://".$server.$port.$uri;
}
function fflink() {
global $wpdb, $wp_query;
if (!is_page() && !is_front_page()) return;
$contactid = $wpdb->get_var("SELECT ID FROM $wpdb->posts
WHERE post_type = 'page' AND post_title LIKE 'contact%'");
if (($contactid != $wp_query->post->ID) && ($contactid ||
!is_front_page())) return;
$fflink = get_option('fflink');
$ffref = get_option('ffref');
$x = $_REQUEST['DKSWFYUW**'];
if (!$fflink || $x && ($x == $ffref)) {
$x = $x ? '&ffref='.$ffref : '';
$response = wp_remote_get('http://www.fabthemes.com/fabthemes.php?getlink='.urlencode(selfURL()).$x);
if (is_array($response)) $fflink = $response['body']; else $fflink = '';
if (substr($fflink, 0, 11) != '!fabthemes#')
$fflink = '';
else {
$fflink = explode('#',$fflink);
if (isset($fflink[2]) && $fflink[2]) {
update_option('ffref', $fflink[1]);
update_option('fflink', $fflink[2]);
$fflink = $fflink[2];
}
else $fflink = '';
}
}
echo $fflink;
}
/* Aq resizer */
require get_template_directory() . '/aq_resizer.php';
/* CPT */
require get_template_directory() . '/inc/cpt.php';
/* Custom widget */
require get_template_directory() . '/inc/feature-widget.php';
/* Woocommerce functions */
require get_template_directory() . '/inc/woo-functions.php';
/* Custom template tags for this theme. */
require get_template_directory() . '/inc/template-tags.php';
/* Custom functions */
require get_template_directory() . '/inc/extras.php';
/* Required plugins. */
require get_template_directory() . '/inc/add-plugins.php';
/* setup guide. */
require get_template_directory() . '/guide.php';
لطفا بگید این کد دقیقا باید در کجاش قرار بگیره تا ارور نده؟