手动将幻灯片添加到现有旋转传送带

时间:2017-11-30 作者:Ian G.

不久前,我从另一位设计师那里继承了一个网站,当时它是随意拼凑起来的。我一直在缓慢地重建它,但从未接触过旋转木马。现在,我的客户希望向旋转木马添加更多图像,而我找不到扩展旋转木马中图像数量的位置,在仪表板中传递了5个图像。我能想到的唯一解决方案是进入主页的代码并添加幻灯片。这是一个可行的解决方案吗?

网站为www.sbbl。商务部

<div style="position: relative;float: left;">
    <ul class="rslides rslides1">

                                    <li id="rslides1_s0" class="" style="display: block; float: none; position: absolute; opacity: 0; z-index: 1; transition: opacity 500ms ease-in-out;"><a href="http://www.sbbl.biz/clients/holocaust-history-center-2/" class="image-anchor">1255<img width="992" height="560" src="http://www.sbbl.biz/wp-content/uploads/clientfocus_HHC-copy.jpg" class="attachment-full size-full wp-post-image" alt="" srcset="http://www.sbbl.biz/wp-content/uploads/clientfocus_HHC-copy.jpg 992w, http://www.sbbl.biz/wp-content/uploads/clientfocus_HHC-copy-300x169.jpg 300w, http://www.sbbl.biz/wp-content/uploads/clientfocus_HHC-copy-768x434.jpg 768w" sizes="(max-width: 992px) 100vw, 992px"></a></li>

                                    <li id="rslides1_s1" style="float: none; position: absolute; opacity: 0; z-index: 1; display: list-item; transition: opacity 500ms ease-in-out;" class=""><a href="http://www.sbbl.biz/clients/girl-scouts/" class="image-anchor">2145<img width="992" height="560" src="http://www.sbbl.biz/wp-content/uploads/clientfocus_Girl-Scouts-2-1.jpg" class="attachment-full size-full wp-post-image" alt="" srcset="http://www.sbbl.biz/wp-content/uploads/clientfocus_Girl-Scouts-2-1.jpg 992w, http://www.sbbl.biz/wp-content/uploads/clientfocus_Girl-Scouts-2-1-300x169.jpg 300w, http://www.sbbl.biz/wp-content/uploads/clientfocus_Girl-Scouts-2-1-768x434.jpg 768w" sizes="(max-width: 992px) 100vw, 992px"></a></li>

                                    <li id="rslides1_s2" style="float: none; position: absolute; opacity: 0; z-index: 1; display: list-item; transition: opacity 500ms ease-in-out;" class=""><a href="http://www.sbbl.biz/clients/tucson-jewish-community-center-2/" class="image-anchor">2079<img width="992" height="560" src="http://www.sbbl.biz/wp-content/uploads/clientfocus_JCC-PHASE-3-copy.jpg" class="attachment-full size-full wp-post-image" alt="" srcset="http://www.sbbl.biz/wp-content/uploads/clientfocus_JCC-PHASE-3-copy.jpg 992w, http://www.sbbl.biz/wp-content/uploads/clientfocus_JCC-PHASE-3-copy-300x169.jpg 300w, http://www.sbbl.biz/wp-content/uploads/clientfocus_JCC-PHASE-3-copy-768x434.jpg 768w" sizes="(max-width: 992px) 100vw, 992px"></a></li>

                                    <li id="rslides1_s3" style="float: none; position: absolute; opacity: 0; z-index: 1; display: list-item; transition: opacity 500ms ease-in-out;" class=""><a href="http://www.sbbl.biz/clients/city-park/" class="image-anchor">2072<img width="992" height="560" src="http://www.sbbl.biz/wp-content/uploads/clientfocus_City-Park-2.jpg" class="attachment-full size-full wp-post-image" alt="" srcset="http://www.sbbl.biz/wp-content/uploads/clientfocus_City-Park-2.jpg 992w, http://www.sbbl.biz/wp-content/uploads/clientfocus_City-Park-2-300x169.jpg 300w, http://www.sbbl.biz/wp-content/uploads/clientfocus_City-Park-2-768x434.jpg 768w" sizes="(max-width: 992px) 100vw, 992px"></a></li>

                                    <li id="rslides1_s4" style="float: left; position: relative; opacity: 1; z-index: 2; display: list-item; transition: opacity 500ms ease-in-out;" class="rslides1_on"><a href="http://www.sbbl.biz/clients/tucson-jewish-community-center/" class="image-anchor">178<img width="992" height="560" src="http://www.sbbl.biz/wp-content/uploads/clientfocus_JCC2.jpg" class="attachment-full size-full wp-post-image" alt="" srcset="http://www.sbbl.biz/wp-content/uploads/clientfocus_JCC2.jpg 992w, http://www.sbbl.biz/wp-content/uploads/clientfocus_JCC2-300x169.jpg 300w, http://www.sbbl.biz/wp-content/uploads/clientfocus_JCC2-768x434.jpg 768w" sizes="(max-width: 992px) 100vw, 992px"></a></li>
                    </ul><a href="#" class="rslides_nav rslides1_nav prev">Previous</a><a href="#" class="rslides_nav rslides1_nav next">Next</a>
    </div>
转盘截图:

screenshot

提前感谢您提供的任何知识。

1 个回复
SO网友:Daniel Fonda

不,这不是一个可行的解决方案。永远不要硬编码这样的内容。

假设你有一个滑块,你应该创建一个自定义的帖子类型(或者使用一个插件,比如ACF 创建转发器字段。

然后查询上述帖子或字段的循环,并创建适当的html标记。这样,幻灯片就可以通过wp admin进行编辑。

希望这有帮助。

结束