Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.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
wordpress中插件上没有有效的标题_Wordpress_Plugins - Fatal编程技术网

wordpress中插件上没有有效的标题

wordpress中插件上没有有效的标题,wordpress,plugins,Wordpress,Plugins,我已经创建了一个插件,出于某种原因,当我试图上传并通过zip激活它。我收到消息“没有有效的标题”。如果我只是通过ftp删除文件夹,看起来还可以。有什么建议吗 以下是插件的主要文件: <?php /* * Plugin Name: Album Gallery * Plugin URI: http://vinteractive.co.uk * Description: An Album based Slider Gallery. * Version: 1.0 * Author: Vi

我已经创建了一个插件,出于某种原因,当我试图上传并通过zip激活它。我收到消息“没有有效的标题”。如果我只是通过ftp删除文件夹,看起来还可以。有什么建议吗

以下是插件的主要文件:

<?php
/*
 * Plugin Name: Album Gallery
 * Plugin URI: http://vinteractive.co.uk
 * Description: An Album based Slider Gallery.
 * Version: 1.0
 * Author: Vincent Stephens
 * Author URI: http://vinteractive.co.uk
 * License: Do Not Redistribute
 */

define('ALBUM_GALLERY_URL', plugins_url() . '/album-gallery/');
define('ALBUM_GALLERY_ABSPATH', ABSPATH . 'wp-content/plugins/album-gallery/');

define( 'ACF_LITE' , true );
include(ALBUM_GALLERY_ABSPATH . 'custom-fields/acf.php');
include(ALBUM_GALLERY_ABSPATH . 'custom-fields/album-fields.php');
include(ALBUM_GALLERY_ABSPATH . 'custom-post-types/albums-gallery-post-type.php');
include(ALBUM_GALLERY_ABSPATH . 'shortcodes/shortcodes.php');


// Enque Scripts and styles
function album_gallery_scripts() {
wp_register_script('jquery-for-nivo', plugins_url('/js/jquery-1.9.0.min.js', __FILE__), array('jquery'),'1.1', true);
wp_enqueue_script('jquery-for-nivo');
wp_register_script('nivo-slider', plugins_url('/nivo/scripts/jquery.nivo.slider.js', __FILE__), array('jquery'),'1.1', true);
wp_enqueue_script('nivo-slider');
wp_register_script('album-gallery-script', plugins_url('/js/album-gallery.jquery.js', __FILE__), array('jquery'),'1.1', true);
wp_enqueue_script('album-gallery-script');

wp_register_style('album-gallery', plugins_url('/css/album-gallery.css', __FILE__));
wp_enqueue_style('album-gallery');
wp_register_style('nivo-slider', plugins_url('/nivo/nivo-slider.css', __FILE__));
wp_enqueue_style('nivo-slider');
wp_register_style('style', plugins_url('/nivo/style.css', __FILE__));
wp_enqueue_style('style');

// Nivo Theme
wp_register_style('theme-default', plugins_url('/nivo/themes/default/default.css', __FILE__));
wp_enqueue_style('theme-default');
}

add_action( 'wp_enqueue_scripts', 'album_gallery_scripts' );  


?>

短代码文件:

<?php 
    function album_gallery_shortcode() {
?>
        <span class="info_btn"></span>

        <?php 
        // Loop for Album Gallery Post Type
            $args = array(
                'post_type'         => 'albums_gallery',
            );

            $loop = new WP_Query( $args );
            while ( $loop->have_posts() ) : $loop->the_post();

            $album_name = get_the_ID();
            $album_description = get_field('album_description');

        ?>

        <div class="album album_<?php echo $album_name ?>">

        <?php for ($i = 0; $i <= 0; $i++) { ?>
            <div class="description album_<?php echo $album_name ?>">
                <?php echo $album_description; ?>
            </div>
        <?php } ?>

            <div class="slider-wrapper theme-default">
                <div class="slider" class="nivoSlider">

                    <?php

                    $images = Array();
                    for($i = 1; $i <= 6; $i++) {
                        $image = get_field("image_{$i}");
                        if(!$image || !$image['url']) {
                            break;
                        }
                        $caption = get_field("image_{$i}_caption");
                        ?>

                        <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" title="<?php echo $caption; ?>" />

                    <?php } ?>

                </div>
            </div>
        </div>
        <!-- End Album -->

        <?php endwhile; wp_reset_query(); ?>
        <!-- // Loop for Album Gallery Post Type -->

        <div class="thumbnails">
        <?php 

            $args = array(
                'taxonomy_albums'   => '',
                'post_type'         => 'albums_gallery',
            );

            $loop = new WP_Query( $args ); 
            while ( $loop->have_posts() ) : $loop->the_post();

            // album name becomes post id
            $album_name = get_the_id();
            $album_thumb = get_field('thumbnail');
            $album_caption = get_field('album_caption');

            if( !empty($album_thumb) ): ?>

                <div class="thumbs" style="width: 130px; float: left; margin: 5px;">
                    <img class="thumb thumb_album_<?php echo $album_name; ?>" src="<?php echo $album_thumb['url']; ?>" alt="<?php echo $album_thumb['alt']; ?>" width="130" />
                    <p class="title"><?php the_title();  ?></p>
                    <p class="caption"><?php echo $album_caption ?></p>
                </div>

        <?php endif; ?>
        <?php endwhile; wp_reset_query(); ?>

    </div>
    <!-- end thumbnails -->


<?php

    }
    add_shortcode( 'album-gallery', 'album_gallery_shortcode' );
?>


我怀疑这与您的插件中包含的高级自定义帖子插件有关。我有一个类似的问题,我通过将acf文件夹向下移动一级来解决它。意思是,我把它放在
myplugin/inc/advanced custom字段中,而不是
myplugin/advanced custom字段中

它成功了

当然,不要忘记将插件主文件的路径更改为

include(ALBUM_GALLERY_ABSPATH . 'inc/custom-fields/acf.php');
顺便说一句,我更喜欢这样称呼插件:

if( !class_exists('Acf') )
{
    define( 'ACF_LITE' , true ); // Hide it from admin
    include_once('inc/advanced-custom-fields/acf.php' );
}

因为如果用户已经安装了它,您不希望用户再次加载它

在插件中包含ACF时,我也遇到了类似的问题,我花了很长时间才弄明白,尤其是每次创建新插件时,我都会以同样的方式删除插件头模板


问题源于包含的acf.php插件头。从该文件中删除wordpress注释头,无论您从哪个目录级别将其包括在内,它似乎都可以正常安装。

忽略前面的注释。。。您是如何创建ZIP的?它必须只有
/plugin folder/all files.*
。文件结构是:相册库-css-自定义字段-自定义帖子类型-图片-js-nivo-短码我正在使用上下文菜单“压缩”在查找器中创建zip在专用应用程序中打开zip并确认结构。或者如果你想发布一个zip,我可以查看。@brasofilo-这是链接。我在osx finderYep中创建了zip,这就是我如何摆脱它的原因,当时…:)