- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用这个 wordpress 主题 https://wordpress.org/themes/sleeky/我想包括一个新的小部件层。
我想要这个的原因是我想要一个 col-xs-12 小部件大小的文本正下方的横幅。下面是 3 个 col-xs-4 框....但我发现这个主题很难实现。
我的主题有“顶部”和“底部”,每个都有 4 个可能的部分。似乎如果我在“顶部”中只有 1 个小部件,它会分配给它 col-xs-12 - 完美!但现在我想要 3x col-xs-4 在他们自己的行下面,但我不能使用“顶部”小部件,因为主题中的这段代码将 col-xs-12 减少为 col-xs-3:
// lets setup the inset top group
function sleeky_topgroup() {
$count = 0;
if ( is_active_sidebar( 'top1' ) )
$count++;
if ( is_active_sidebar( 'top2' ) )
$count++;
if ( is_active_sidebar( 'top3' ) )
$count++;
if ( is_active_sidebar( 'top4' ) )
$count++;
$class = '';
switch ( $count ) {
case '1':
$class = 'col-md-12';
break;
case '2':
$class = 'col-md-6';
break;
case '3':
$class = 'col-md-4';
break;
case '4':
$class = 'col-md-3';
break;
}
if ( $class )
echo $class;
}
因此...我想包括另一个“中间”层,这样我就可以将“顶部”与 1 个元素一起使用,给它 col-xs-12,然后给中间 3 个元素,这会给每个 col-xs -4 :)
我找到了文件 inc/sleeky_widgets.php 并将其更改为包含 mid1、mid2、mid3、mid4 选项....如下所示:
<?php
/*
=================================================
sleeky Date Theme Widget Positions
This Files will show widgets on the back end of the file
@package sleeky
=================================================
*/
function sleeky_widgets_init() {
register_sidebar( array(
'name' => __( 'Blog Sidebar', 'sleeky' ),
'id' => 'blogright',
'description' => __( 'This is the right sidebar column that appears on the blog but not the pages.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><hr/>',
) );
register_sidebar( array(
'name' => __( 'Page Sidebar', 'sleeky' ),
'id' => 'pagesidebar',
'description' => __( 'This is the right sidebar column that appears on the blog but not the pages.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><hr/>',
) );
register_sidebar( array(
'name' => __( 'Banner Wide', 'sleeky' ),
'id' => 'banner-wide',
'description' => __( 'This is a full width showcase banner for images or media sliders that can display on your pages.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><hr/>'
) );
register_sidebar( array(
'name' => __( 'Top 1', 'sleeky' ),
'id' => 'top1',
'description' => __( 'This is the 1st top widget position located just below the banner area.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Top 2', 'sleeky' ),
'id' => 'top2',
'description' => __( 'This is the 2nd top widget position located just below the banner area.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Top 3', 'sleeky' ),
'id' => 'top3',
'description' => __( 'This is the 3rd top widget position located just below the banner area.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Top 4', 'sleeky' ),
'id' => 'top4',
'description' => __( 'This is the 4th top widget position located just below the banner area.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Mid 1', 'sleeky' ),
'id' => 'mid1',
'description' => __( 'This is the 1st mid widget position located just below the banner area.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Mid 2', 'sleeky' ),
'id' => 'mid2',
'description' => __( 'This is the 2nd top widget position located just below the banner area.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Mid 3', 'sleeky' ),
'id' => 'mid3',
'description' => __( 'This is the 3rd top widget position located just below the banner area.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Mid 4', 'sleeky' ),
'id' => 'mid4',
'description' => __( 'This is the 4th top widget position located just below the banner area.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Bottom 1', 'sleeky' ),
'id' => 'bottom1',
'description' => __( 'This is the first bottom widget position located in a coloured background area just above the footer.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Bottom 2', 'sleeky' ),
'id' => 'bottom2',
'description' => __( 'This is the second bottom widget position located in a coloured background area just above the footer.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Bottom 3', 'sleeky' ),
'id' => 'bottom3',
'description' => __( 'This is the third bottom widget position located in a coloured background area just above the footer.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Bottom 4', 'sleeky' ),
'id' => 'bottom4',
'description' => __( 'This is the fourth bottom widget position located in a coloured background area just above the footer.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3><span class="dotbox"></span>',
'after_title' => '</h3><div class="dotlinebox"><span class="dot"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Call to Action', 'sleeky' ),
'id' => 'cta',
'description' => __( 'This is a call to action which is normally used to make a message stand out just above the main content.', 'sleeky' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'sleeky_widgets_init' );
/**
* Count the number of widgets to enable resizable widgets
*/
// lets setup the inset top group
function sleeky_topgroup() {
$count = 0;
if ( is_active_sidebar( 'top1' ) )
$count++;
if ( is_active_sidebar( 'top2' ) )
$count++;
if ( is_active_sidebar( 'top3' ) )
$count++;
if ( is_active_sidebar( 'top4' ) )
$count++;
$class = '';
switch ( $count ) {
case '1':
$class = 'col-md-12';
break;
case '2':
$class = 'col-md-6';
break;
case '3':
$class = 'col-md-4';
break;
case '4':
$class = 'col-md-3';
break;
}
if ( $class )
echo $class;
}
function sleeky_middlegroup() {
$count = 0;
if ( is_active_sidebar( 'mid1' ) )
$count++;
if ( is_active_sidebar( 'mid2' ) )
$count++;
if ( is_active_sidebar( 'mid3' ) )
$count++;
if ( is_active_sidebar( 'mid4' ) )
$count++;
$class = '';
switch ( $count ) {
case '1':
$class = 'col-md-12';
break;
case '2':
$class = 'col-md-6';
break;
case '3':
$class = 'col-md-4';
break;
case '4':
$class = 'col-md-3';
break;
}
if ( $class )
echo $class;
}
// lets setup the content bottom group
function sleeky_contentbottomgroup() {
$count = 0;
if ( is_active_sidebar( 'contentbottom1' ) )
$count++;
if ( is_active_sidebar( 'contentbottom2' ) )
$count++;
if ( is_active_sidebar( 'contentbottom3' ) )
$count++;
if ( is_active_sidebar( 'contentbottom4' ) )
$count++;
$class = '';
switch ( $count ) {
case '1':
$class = 'dsp-md-12';
break;
case '2':
$class = 'dsp-md-6';
break;
case '3':
$class = 'dsp-md-4';
break;
case '4':
$class = 'dsp-md-3';
break;
}
if ( $class )
echo 'class="' . $class . '"';
}
// lets setup the bottom group
function sleeky_bottomgroup() {
$count = 0;
if ( is_active_sidebar( 'bottom1' ) )
$count++;
if ( is_active_sidebar( 'bottom2' ) )
$count++;
if ( is_active_sidebar( 'bottom3' ) )
$count++;
if ( is_active_sidebar( 'bottom4' ) )
$count++;
$class = '';
switch ( $count ) {
case '1':
$class = 'col-md-12';
break;
case '2':
$class = 'col-md-6';
break;
case '3':
$class = 'col-md-4';
break;
case '4':
$class = 'col-md-3';
break;
}
if ( $class )
echo 'class="' . $class . '"';
}
但是,当我查看用于添加新小部件的侧边栏时,我没有在其中看到我的新选项。它看起来如下:
最佳答案
好吧,在折腾之后,我发现了另一个文件,名为:sidebar-top.php
添加后:
<div class="sleeky_widget_mid">
<div class="container">
<div class="row">
<div id="mid1" class="<?php sleeky_middlegroup(); ?>" role="complementary">
<?php dynamic_sidebar( 'mid1' ); ?>
</div><!-- #top1 -->
<div id="mid2" class="<?php sleeky_middlegroup(); ?>" role="complementary">
<?php dynamic_sidebar( 'mid2' ); ?>
</div><!-- #top2 -->
<div id="mid3" class="<?php sleeky_middlegroup(); ?>" role="complementary">
<?php dynamic_sidebar( 'mid3' ); ?>
</div><!-- #top3 -->
<div id="mid4" class="<?php sleeky_middlegroup(); ?>" role="complementary">
<?php dynamic_sidebar( 'mid4' ); ?>
</div><!-- #top3 -->
</div>
</div>
</div>
我的菜单选项出现了并且表现非常好!
关于php - 自定义 wordpress 主题以包含新的小部件层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35351205/
我正在尝试将我所有的东西从 videomarathon.com/dk 导入到 videomarathon.com/se(帖子等) 我正在使用 wordpress 导入器。 上传导出的文件时,它向我显示
Azure WordPress 和 Azure 可扩展 WordPress 之间有什么区别?除了可扩展的 WordPress 允许您选择 azure 存储之外,我看不出有什么区别 最佳答案 基本区别:
我目前正在一个与体育相关的 wordpress 网站上工作。我所有的帖子都在同一个地方,分为足球、网球等。我想改变我博客的结构,比如足球,应该是domain.com/football对于网球,应该是
Wordpress 3 有一个漂亮的 TinyMCE 实现,我相信它比它所基于的原始 TinyMCE 运行得流畅得多。 很棒的事情:- HTML/源代码 View 作为选项卡而不是弹出窗口- 有吸引力
我在 codex.wordpress.org 和developer.wordpress.org 上看到了 WordPress 开发人员文档。他们都有关于插件和主题的文档。由于我不了解 wordpres
我有自定义帖子循环,我想在底部添加“查看全部”链接,该链接应指向包含该类型所有帖子的页面。 我能想到的唯一解决方案是为帖子类型创建一个模板页面并硬编码指向它的链接,但我希望有一个更优雅和动态的解决方案
我正在尝试使用类在 WordPress 中创建自定义 REST API 端点。我也用传统方法做了同样的事情——效果很好。但是,使用类时出现错误 The handler for the route is
我是 WordPress 的新手,正在尝试在主页的一部分中使用一些自定义代码,该部分旨在显示三个类别(白皮书、文章和帖子)中每个类别的 #1 趋势帖子.代码只是显示(据我所知)最近的 3 个帖子,无论
我正在尝试在 wordpress 中设置搜索页面的样式。在 search.php 中,我可以设置大部分页面的样式,但随后的以下语句(我从未经编辑的原始页面中获得)生成了内容。
我希望得到一些帮助来解决一些让我发疯的编码问题。我更喜欢在我的 wordpress 帖子标题中写“&”而不是“and”。但是写出&符号会破坏我们的 twitter、facebook 和 google-
是否可以只重写一个类别? 我有一个类别“ 照片”,并且只针对这个类别。 我只想从/category/photos重写它至 /photos 最佳答案 您可以使用 WP Rewrite API 来实现。
我有一个托管在 www.example.com 上的网站,它是一个 Bitnami 应用程序。 我想在 www.example.com/blog 上可以访问的同一台服务器上安装另一个 bitnami
我一直在做一些测试。注意:这仅在Safari浏览器中发生。 我关闭了所有插件并激活了主题二十(而不是我的Catch Box子主题)。在此配置下,除了顶部菜单中的“主页”选项卡(在Safari中显示如下
我是一名 php 开发人员,目前正在开发一个 CMS/博客系统。我想添加一个永久链接系统,比如 WordPress。我很好奇 WordPress 如何解析永久链接。例如,如何获取 id 这样的数据和
有谁知道Wordpress有多安全? 我不知道如何定义“有多安全”。但与其他CMS系统相比,它的安全性如何? 更新: 详细说明我的项目。 我会有很多用户注册。登录后,他们将可以访问我正在开发的插件。大
是否可以授予编辑者管理主题小部件的功能?默认情况下,只有管理员可以这样做。 谢谢, 乔恩 最佳答案 恐怕您将需要使用插件来实现此目的,因为更改窗口小部件是switch_themes capabilit
我有一个在服务器上运行的多站点 wordpress,我想将我的站点转移到另一台服务器上。我通过 filezilla ftp 下载了完整的文件备份还导出了完整的数据库。 现在我将此备份导入到新服务器 (
我使用通用 HTML 标签在 WordPress 插件中创建了一个表单。我刚刚用 echo 测试了文本框提交的值,它工作正常。提交表单后,我需要在同一页面中重定向或显示成功/失败消息。表单提交后如何显
我想启用 wordpress 站点的调试日志,在 wp-config.php 中添加以下设置 /* WordPress debug mode for developers. */ define('WP
是否可以仅在前端(无需编辑 .mo/.po 文件)更改我的 wordpress 安装(WP 3.0 Multisite)的语言? 在此处更改此选项: 也会在后端更改我的语言。 有任何想法吗? 感谢您的
我是一名优秀的程序员,十分优秀!