Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 未捕获类型错误:对象[对象对象]没有方法';flexslider&x27;_Php_Wordpress Theming_Flexslider - Fatal编程技术网

Php 未捕获类型错误:对象[对象对象]没有方法';flexslider&x27;

Php 未捕获类型错误:对象[对象对象]没有方法';flexslider&x27;,php,wordpress-theming,flexslider,Php,Wordpress Theming,Flexslider,我在这里读到这个错误意味着我要么有两个jQuery列表,要么没有必要的插件。在我的函数或head等中,我没有看到jQuery的第二个队列,所以我想我是做了后者?我刚开始在树屋进行Wordpress的开发,所以非常感谢您的耐心 这是我的functions.php jQuery(document).ready(function($) { $('.flexslider').flexslider(); **Uncaught TypeError: Object [object Obje

我在这里读到这个错误意味着我要么有两个jQuery列表,要么没有必要的插件。在我的函数或head等中,我没有看到jQuery的第二个队列,所以我想我是做了后者?我刚开始在树屋进行Wordpress的开发,所以非常感谢您的耐心

这是我的functions.php

jQuery(document).ready(function($) {
    $('.flexslider').flexslider();      
**Uncaught TypeError: Object [object Object] has no method 'flexslider'**
});

这是我的首页。php:

<?php

//Load the Theme CSS
function theme_styles() {

    wp_enqueue_style( 'normalize', get_template_directory_uri() . '/css/normalize.css' );
    wp_enqueue_style( 'grid', get_template_directory_uri() . '/css/grid.css' );
    wp_enqueue_style( 'googlefonts', 'http://fonts.googleapis.com/css?family=Sorts+Mill+Goudy:400,400italic' ); 
    wp_enqueue_style( 'main', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'social', get_template_directory_uri() . '/css/webfonts/ss-social.css' );

    wp_register_style( 'flex-stylesheet', get_stylesheet_directory_uri() . '/css/flexslider.css', array(), '', 'all' );
    if( is_page( 'home' ) ) {
        wp_enqueue_style('flex-stylesheet');
    }

}

//Load the Theme JS
function theme_js() {

    wp_register_script( 'flexslider', get_stylesheet_directory_uri() . '/js/jquery.flexslider-min.js', array(), '2.1', false );
    if( is_page( 'home' ) ) {
        wp_enqueue_script( 'flexslider' );
    }
    wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true );
//jquery from google cdn
     wp_deregister_script('jquery');
     wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', false, '1.8.3');
     wp_enqueue_script( 'jquery' );

}

add_action( 'wp_enqueue_scripts', 'theme_js' );

add_action( 'wp_enqueue_scripts', 'theme_styles' );

//Enable custom menus
add_theme_support( 'menus' );

function create_widget( $name, $id, $description ) {
    $args = array(
        'name'          => __( $name ),
        'id'            => $id,
        'description'   => $description,
        'before_widget' => '',
        'after_widget'  => '',
        'before_title'  => '<h5>',
        'after_title'   => '</h5>' 
    );

    register_sidebar( $args );

}

create_widget( 'Left Footer', 'footer_left', 'Displays in the bottom left of footer');

create_widget( 'Middle Footer', 'footer_middle', 'Displays in the bottom middle of footer');

create_widget( 'Right Footer', 'footer_right', 'Displays in the bottom right of footer');


?>

    尝试更改: wp_register_script('flexslider',get_stylesheet_directory_uri()。/js/jquery.flexslider-min.js',array(),'2.1',false)

    致: wp_register_script('flexslider',get_template_directory_uri()。/js/flexslider.js',array('jquery'),'',true)

    您可能没有调用正确的文件名


    干杯,

    在寻找
    jquery.flexslider-min.js
    之前,你需要先找到
    jquery.min.js
    。所以我切换了这些,但是flexslider仍然没有出现。思想?
    <?php get_header('header.php'); ?>
        </div>
        <div id="featured" class="clearfix flexslider">
            <ul class="slides">
    
            <?php 
    
                $args = array(
                    'post_type' => 'work'
                );
    
                $the_query = new WP_Query( $args );
    
            ?>
    
            <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
            <li style="background-color:<?php the_field( 'background_color' ); ?>;">
            <div class="container">
                <div class="grid_6">
                    <img src="<?php the_field( 'homepage_slider_image' ); ?>" alt="<?php the_title(); ?> Project Screenshot">
                </div>
                <div id="featured-info" class="grid_4 omega">
                    <h3 style="color: <?php the_field( 'button_color' ); ?>"><?php the_title(); ?></h3>
                    <p><?php the_field( 'description' ); ?></p>
                    <a class="btn blue" style="background-color: <?php the_field( 'button_color' ); ?>" href="<?php the_permalink(); ?>">View Project &rarr;</a>
                </div>
            </div>
            </li>
            <?php endwhile; endif; ?>
            </ul>
        </div>
    
    
        <div class="container clearfix">
            <div class="grid_12 omega">
                <h5>Featured Post</h5>
            </div>
    
            <?php
    
                $args = array(
                    'post_type' => 'post',
                    'category_name' => 'featured',
                    'posts_per_page' => 1
                );
    
                $the_query = new WP_Query( $args );
    
            ?>
    
            <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    
            <div class="push_2 grid_10 omega clearfix">
                <article>
    
                    <?php get_template_part( 'content', 'post' ); ?>
    
                </article>
            </div>
    
            <?php endwhile; endif; ?>
    
            <div class="grid_12 content clearfix">
                <div class="grid_6 recent-post">
                    <article>
                        <h5>Recent Posts</h5>
                        <?php
    
                            $args = array(
                                'post_type' => 'post',
                                'cat' => '-5',
                                'posts_per_page' => 1
                            );
    
                            $the_query = new WP_Query( $args );
    
                        ?>
    
                        <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    
                            <?php get_template_part( 'content', 'post' ); ?>
    
                        <?php endwhile; endif; ?>
    
                    </article>
    
                </div>
                    <?php 
    
                        $args = array(
                        'post_type' => 'work',
                        'posts_per_page' => 1
                        );
    
                        $the_query = new WP_Query( $args );
    
                        ?>
    
                    <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    
                        <?php get_template_part( 'content', 'work' ); ?>
    
                    <?php endwhile; endif; ?>
            </div>
    
    
    <?php get_template_part( 'content', 'testimonials' ); ?>
    
    <?php get_footer('footer.php'); ?>