我正在为我的网站开发一个公文包页面,我尽可能多地使用了这样的功能,当我将鼠标悬停在每个项目的列表名称上时,它会在网站的左侧显示相同的标题,如下所示:
我想做的是,当您将鼠标悬停在右侧的项目标题上时,媒体库中的图像会显示在左侧,这样我就可以开始取得一些进展。不幸的是,这个WordPress构建是不同的,我不是从头开始构建的,我在函数中注意到了这一点。php页面,没有add\\u theme\\u支持(“post\\u缩略图”),而是我在函数中看到的全部内容。php:
<?php
/**
* Theme functions and definitions.
*
* Sets up the theme and provides some helper functions
*
* When using a child theme (see http://codex.wordpress.org/Theme_Development
* and http://codex.wordpress.org/Child_Themes), you can override certain
* functions (those wrapped in a function_exists() call) by defining them first
* in your child theme\'s functions.php file. The child theme\'s functions.php
* file is included before the parent theme\'s file, so the child theme
* functions would be used.
*
*
* For more information on hooks, actions, and filters,
* see http://codex.wordpress.org/Plugin_API
*
* @package CMMS
* @author Creative MMS
*
*
* @since 1.1.0
*/
/*---------------------------------------------------------------------------*/
/* Load the parent style.css file
/*---------------------------------------------------------------------------*/
add_action(\'wp_enqueue_scripts\', \'enqueue_parent_styles\');
function enqueue_parent_styles() {
wp_enqueue_style(\'parent-style\', get_template_directory_uri().\'/style.css\');
}
/*------------------------------------------------------------------
[Load Files]
-------------------------------------------------------------------*/
function cmms_child_load_files() {
$dir = get_stylesheet_directory();
// Include ACF Theme Functions
require_once ( $dir.\'/inc/acf/acf_groups.php\' );
require_once ( $dir.\'/inc/acf/acf.php\' );
}
add_action(\'acf/init\', \'cmms_child_load_files\');
/*------------------------------------------------------------------
[Add Child scripts]
-------------------------------------------------------------------*/
function cmms_child_assets() {
// Directory to pull assets from
$dir = get_stylesheet_directory_uri();
//Use for DEV
//wp_enqueue_script(\'child-scripts\', $dir.\'/assets/js/child-scripts.js\', array(\'jquery\'), \'1.0\', true);
wp_enqueue_script( \'cmms-tween-max\', $dir . \'/assets/js/plugins/ScrollMagic/TweenMax.min.js\', array( \'jquery\' ), \'1.0\', true );
wp_enqueue_script( \'cmms-scroll-magic\', $dir . \'/assets/js/plugins/ScrollMagic/ScrollMagic.min.js\', array( \'jquery\' ), \'1.0\', true );
wp_enqueue_script( \'cmms-animation\', $dir . \'/assets/js/plugins/ScrollMagic/animation.gsap.min.js\', array( \'jquery\' ), \'1.0\', true );
wp_enqueue_script( \'cmms-add-indicators\', $dir . \'/assets/js/plugins/ScrollMagic/debug.addIndicators.min.js\', array( \'jquery\' ), \'1.0\', true );
//Use for PRODUCTION
wp_enqueue_script( \'cmms-child-app\', $dir . \'/assets/js/cmms-child-app.min.js\', array( \'jquery\' ), \'1.0\', true );
}
add_action(\'wp_enqueue_scripts\', \'cmms_child_assets\');
如何从媒体库中加载一些图像,而不在函数中添加主题支持(“post\\u缩略图”)。php?这是我知道怎么做的唯一方法。我的想法是,然后添加以下代码:
<?php the_post_thumbnail(); ?>
此处:
<li class="item <?php if ($count == 1) : ?>active<?php endif; ?>" id="<?= $count; ?>"><?php the_post_thumbnail(); ?></li>
以上代码来自存档工作。php:
<?php
/**
* Work template file.
*
* This is the most generic template file in a WordPress theme and one of the
* two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* For example, it puts together the home page when no home.php file exists.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package CMMS
* @author Creative MMS
*
*
* @since 1.0.0
*/
get_header(); ?>
<div class="cmms-house">
<div class="content-area cmms-clr">
<main class="site-main cmms-clr">
<?php
// Display page header
//get_template_part( \'partials/archives/header\' ); ?>
<?php
// Check if posts exist
if ( have_posts() ) : ?>
<div class="work-entry cmms-clr">
<div class="work-col work-left">
<ul>
<?php
// Get query
global $wp_query;
// Count
$count = 1;
// Loop through posts
while ( have_posts() ) : the_post(); ?>
<li class="item <?php if ($count == 1) : ?>active<?php endif; ?>" id="<?= $count; ?>"><?php the_post_thumbnail(); ?><?= get_the_title(); ?></li>
<?php
// End loop
$count++; endwhile;
?>
<?php wp_reset_postdata(); ?>
</ul>
</div><!-- .left -->
<div class="work-col work-right">
<ul>
<?php
// Get query
global $wp_query;
//Counter
$counter = 1;
// Loop through posts
while ( have_posts() ) : the_post(); ?>
<li class="list-right" data-trigger="#<?= $counter; ?>"><?= get_the_title(); ?></li>
<?php
// End loop
$counter++; endwhile;
?>
<?php wp_reset_postdata(); ?>
</ul>
</div><!-- .right -->
</div><!-- .work-entry -->
<?php
// Include pagination template part
cmms_include_template( \'partials/global/pagination.php\' ); ?>
<?php
// Display no posts found message
else : ?>
<?php get_template_part( \'partials/entry/none\' ); ?>
<?php endif; ?>
</main><!-- .main -->
</div><!-- .content-area -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>