0

我正在创建一个 wordpress 主题,其中文件夹 'wordpress' 位于我的 'documents' 文件夹中。那里的特色图片选项就像一个魅力。当我在新数据库上安装主题(复制、粘贴到主题文件夹)时,上传特色图片的选项消失或未显示,而 functions.php 文件夹未更改。有人有解决这个问题的方法吗?

我已经包含了 functions.php 文件和 index.php 文件(在新数据库上是相同的,因为我将主题文件夹复制、粘贴到新的 wp-content->themes 文件夹中。

函数.php

<?php

function blvck_resources() {

wp_enqueue_style('style', get_stylesheet_uri());

load_theme_textdomain( 'majestic', get_template_directory() . '/languages' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );

}

add_action('wp_enqueue_scripts', 'blvck_resources');

require get_template_directory() . '/customizations/custom-header.php';

索引.php

<?php

get_header();

if (have_posts()) :?>

<div id="freewall" class="free-wall">
<?php
while (have_posts()) : the_post(); 
?>
    <a href="<?php the_permalink() ?>">
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            <div class="brick">
                <span><?php the_post_thumbnail(); ?></span>
                <div class="info">
                   <h4 class="post-title"><?php the_title(); ?></h4>
                   <h6 class="post-date"><?php the_time(get_option('date_format')); ?></h6>
                </div>
            </div>
        </article>
    </a>
<?php endwhile;
?>
</div>

<?php
    else :
        echo '<p>No content found</p>';
    endif;
?>
<script type="text/javascript" src="wp-content/themes/Majestic/js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="wp-content/themes/Majestic/js/freewall.js"></script>
<script type="text/javascript" src="wp-content/themes/Majestic/js/centering.js"></script>
<script type="text/javascript">
    $(window).load(function() {
        var wall = new freewall("#freewall");
        wall.reset({
            selector: '.brick',
            animate: true,
            cellW: 300,
            cellH: 'auto',
            onResize: function() {
                wall.fitWidth();
            }
        });

        // $('#freewall').find('.brick img').hide();

            wall.fitWidth();
    });
</script>

<?php
    get_footer();
?>
4

1 回答 1

1

add_theme_support需要尽快打电话。尝试像这样使用它:

function custom_theme_setup() {
  load_theme_textdomain( 'majestic', get_template_directory() . '/languages' );
  add_theme_support( 'title-tag' );
  add_theme_support( 'post-thumbnails' );
}
add_action( 'after_setup_theme', 'custom_theme_setup' );    
于 2015-01-10T00:58:21.843 回答