小编Ben*_*ers的帖子

无法修改标题信息 - 已由...发送的标题Wordpress问题

我遇到了这个错误.我不知道处理这件事.

无法修改标题信息 - 已在/home/ben213/public_html/wp-includes/pluggable.php中发送的标题(由/home/ben213/public_html/wp-content/themes/Bendaggers/functions.php:9开始输出) 934行

我的Functions.php文件行#9是:

<?php if(function_exists('register_sidebar'))register_sidebar();?>
Run Code Online (Sandbox Code Playgroud)

而我的pluggable.php#934是

function wp_redirect($location, $status = 302) {
    global $is_IIS;

    $location = apply_filters('wp_redirect', $location, $status);
    $status = apply_filters('wp_redirect_status', $status, $location);

    if ( !$location ) // allows the wp_redirect filter to cancel a redirect
        return false;

    $location = wp_sanitize_redirect($location);

    if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
        status_header($status); // This causes problems on IIS and some FastCGI setups

    header("Location: $location", true, $status);}
endif;
Run Code Online (Sandbox Code Playgroud)

因为我不是程序员,所以我很难搞清楚这一点.什么似乎是错的?请帮助我...

php wordpress

40
推荐指数
2
解决办法
8万
查看次数

如何自定义Bootstrap 3选项卡颜色

我想在Bootstrap 3中创建一个自定义选项卡.

我所做的是 -

<ul class="nav nav-tabs" id="myTab">
    <script type="text/javascript">
        $(document).ready(function()   {
           //1st (1-1 = 0) tab selected initialy
           $("#myTab li:eq(0) a").tab('show');
        });
    </script>

    <li><a data-toggle="tab" href="#sectionA">SEARCH</a></li>
    <li><a data-toggle="tab" href="#sectionB">ADVANCED</a></li>
</ul>
<div class="tab-content">
    <div id="sectionA" class="tab-pane fade in active">
        Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel,
        butcher voluptate nisi qui.
    </div>
    <div id="sectionB" class="tab-pane fade">
        Vestibulum nec erat eu nulla rhoncus fringilla ut non neque. Vivamus nibh urna.
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我得到一个这样的标签 -

2

但我想让它定制有色.我是Bootstrap 3的新手,所以我不知道该怎么做.

我想要的是这样的事情 - …

html css html5 css3 twitter-bootstrap

32
推荐指数
3
解决办法
11万
查看次数

如何在Wordpress中实现片段缓存(W3TC)

所以我在我的wordpress模板中的index.php文件中有这些代码:

if($detect->isMobile() && !$detect->isTablet() ) {
    include('mobileshares.php');
}
Run Code Online (Sandbox Code Playgroud)

代码的目的是在用户使用移动设备或平板电脑设备时加载php文件.这意味着,如果它是桌面,它将不会被加载.

无论如何,它真的很完美.NOT UNTIL我 在我的wordpress中安装了W3 Total Cache插件.缓存会让一切变得混乱.

这意味着,已缓存的网站将显示给下一位访客.例如,访问者#1使用他的智能手机访问了我的网站.它将显示移动网站的相关性.然后缓存过程将完成其工作.当另一位访客(完全不同的人)访问者#2通过不同的设备(让我们说)桌面访问我的网站时.将显示的网站将是移动桌面.我相信这是因为W3TC缓存插件.不确定我在这里有意义.

所以我做了一些小的读数,发现了一个回答片段缓存.

在我的wp配置文件中编辑并添加几行之后:这是我现在修改的代码:

<!-- mfunc W3TC_DYNAMIC_SECURITY -->
    <?php

        if($detect->isMobile() && !$detect->isTablet() ) {
            include('mobileshares.php');
        }
    ?>
<!-- /mfunc W3TC_DYNAMIC_SECURITY -->
Run Code Online (Sandbox Code Playgroud)

(此代码转到wp-config.php文件)

define('W3TC_DYNAMIC_SECURITY', 'somesecurestring');
Run Code Online (Sandbox Code Playgroud)

我已将我的设置设置为" 磁盘:基本 "并启用" 延迟初始化 ",代码仍然搞砸了!

我究竟做错了什么?你能指出什么是错的吗?你能建议一个更好的方法来实现吗?

我感谢您的所有答案/评论,以便我能解决这个问题.谢谢!

php wordpress caching

14
推荐指数
1
解决办法
601
查看次数

下拉导航菜单显示每个类别的最新帖子

所以我正在尝试在我的wordpress网站上的导航菜单上工作.我正在尝试从hongkiat.com复制导航菜单(如图所示).

在Hongkiat的导航菜单中,您将看到五个(5)父类别(设计/开发,技术,灵感,SOcial COmmerce和交易).一旦用户在父类别上徘徊,它将显示父类别下的最近帖子.

无论如何,我设法编写下拉菜单,其中显示父类别以及它的子类别.现在的困境在于如何在用户悬停的父类别下显示最新帖子(至少3个帖子).

在此输入图像描述

无论如何,这是我的代码:

HTML/PHP

<ul>
    <?php 

        global $post;
        $myposts = get_posts('numberposts=3&offset=1');
        foreach($myposts as $post) ;


        $args = array(
        'show_option_all'    => '',
        'hide_empty'         => '0',
        'orderby'            => 'name',
        'order'              => 'ASC',
        'style'              => 'list',
        'use_desc_for_title' => 1,
        'child_of'           => 0,
        'hierarchical'       => 1,
        'title_li'           => (''),
        'show_option_none'   => __( '' ),
        'number'             => null,
        'echo'               => 1,
        'depth'              => 2,
        'current_category'   => 0,
        'pad_counts'         => 0,
        'taxonomy'           => 'category',
        'walker'             => null
        );
        wp_list_categories( $args ); 
    ?> …
Run Code Online (Sandbox Code Playgroud)

php wordpress navigationbar

12
推荐指数
1
解决办法
1065
查看次数

在页面模板中时,不显示自定义Wordpress循环

我的索引文件中有一个自定义的Wordpress循环,该循环当前不起作用。此自定义WP循环的目的是根据其帖子编号分配不同的类和结构。

不幸的是,下面的代码可在index.php文件中正常运行,但是将其复制到自定义页面模板后无法正常工作。

<?php
/**
* Template Name: custom page template
*/
get_header(); ?>

<?php if (have_posts()) : ?>
<?php $count = 0; ?>
<?php while (have_posts()) : the_post(); ?>
<?php $count++; ?>
<?php if ($count == 1) : ?>

<div class="item1">
<span>hello!</span<?php the_title(); ?>>
</div><!-- .item# --> 

<?php elseif ($count == 2) : ?>      

<div class="item2">
<?php the_title(); ?><span>Hi!</span
</div><!-- .item# --> 

<?php elseif ($count == 3) : ?>      

<div class="item3">
<!-- Put Your Stuff Here -->
</div><!-- …
Run Code Online (Sandbox Code Playgroud)

php wordpress

11
推荐指数
1
解决办法
230
查看次数

在下拉列表Wordpress中显示父级和第一级子级别

我目前有这个代码,在下拉列表中显示所有父类别.

HTML/PHP代码

<ul>
    <?php 
    $args = array(
    'orderby' => 'name',
    'hierarchical' => 1,
    'taxonomy' => 'category',
    'hide_empty' => 0,
    'parent' => 0,
    );
    $categories = get_categories($args);
    foreach($categories as $category) {
    echo '<li><a href="' . get_category_link($category->cat_ID) . '" title="' . $category->name . '">' . $category->name . '</a></li>';
    } 
    ?>
</ul>
Run Code Online (Sandbox Code Playgroud)

下面的代码没有问题.实际上,它完美无缺!你可以在我的wordpress网站上看到它:www.bendaggers.com

我现在想要实现的是如何添加父级的第一级子级,就像它在下面的图像1中所示,具有相同的效果.

图1 - 样本

这就是我想要实现的目标,只要用户在列出的父类别上悬停,它就会显示其第一级子类别,如下图所示.

在此输入图像描述

图2 - 样本父/类别层次结构.

在此输入图像描述

顺便说一句,我还需要一个工作代码PHP,HTML和CSS.

非常感谢你的帮助和努力,非常感谢你!

一些可能有用的其他信息.

  • 该网站是一个wordpress网站.
  • 所有帖子都进行了适当的分类(父母,1级儿童类别被正确分类).

php wordpress

7
推荐指数
1
解决办法
1455
查看次数

如何将Disqus XML导出的注释导入Wordpress WXR

我目前正在将我的评论系统移回默认的Wordpress评论.我之前使用的是Disqus,但我决定退回去.Disqus提供了一个可以导出所有注释的工具,但不幸的是,它们将为您提供XML格式.最糟糕的是WordPress只读取WXR文件格式.

我的解决方案是我应该手动重写Disqus给我的东西(我的意思是我从disqus导出的XML文件)到WordPress WXR文件格式.我的问题是我不知道所需的WordPress评论的基本结构是什么.

您可以在此处查看Disqus导出的XML文件!我唯一关心的是我只需要一个模板或格式,我可以遵循如何编写正确的WXR文件注释,以便我可以使用导入工具直接在我的WordPress中导入它.顺便说一句,当我尝试将XML文件上传到WordPress时,我收到此错误:

无效的文件.请上传有效的Disqus导出文件."

xml wordpress disqus

6
推荐指数
1
解决办法
5674
查看次数

根据PHP或Javascript IF和ELSE Test的结果显示Google Adsense代码

你知道如何编写PHP脚本或Javascript来检测用户的屏幕大小然后执行IF而不测试然后结果会返回特定的显示吗?

我想在这里完成的事情:

  1. Javascript将检测我的网站的用户/访问者的分辨率.(我使用媒体查询得到了这个,我在这方面没有问题)

  2. 然后脚本将执行IF和ELSE功能.如果用户的分辨率= <320x480(移动电话的分辨率),PHP脚本将调用Google Adsense - 移动电话的代码.如果没有,那么它将显示Google Adsense网站的代码.

2个google adsense代码保存在两个不同的文件中,我们只需将它们称为adsense-Mobile.php和adsense-Website.php

这是一个简单的流程图.

流程图

这就是我遇到的问题.许多专家说,Jquery中的一个简单的SHOW-HIDE元素可以完成这项工作.不幸的是,在我的情况下,它没有.

我已经这样做了,它不符合我的要求.问题是来自谷歌的两个广告一次性加载到网站中,只有1个被显示.Google Adsense仅允许展示3个广告.如果我做show-hide jquery,我将失去创造收入的机会,因为其中一个广告是隐藏的.我需要一些不会加载两个代码的东西但只能调用正确的代码(正确的大小,无论是移动还是网站).

我知道PHP可以做到这一点,但我不知道从哪里开始或者我应该开始阅读或研究什么功能.非常需要你的帮助.有任何想法吗?任何PHP或javascript只能调用一个谷歌adsense代码取决于分辨率.

这是谷歌adsense移动和网站的代码.

Google Adsense代码 - 网站

<script type="text/javascript"><!--
google_ad_client = "ca-pub-6099979626157131";
/* Ben Daggers Leader Board */
google_ad_slot = "8829449662";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Run Code Online (Sandbox Code Playgroud)

Google Adsense代码 - MOBILE

<?php

$GLOBALS['google']['client']='ca-mb-pub-6099979626157131';
$GLOBALS['google']['https']=read_global('HTTPS');
$GLOBALS['google']['ip']=read_global('REMOTE_ADDR');
$GLOBALS['google']['markup']='xhtml';
$GLOBALS['google']['output']='xhtml';
$GLOBALS['google']['ref']=read_global('HTTP_REFERER');
$GLOBALS['google']['slotname']='8668582435';
$GLOBALS['google']['url']=read_global('HTTP_HOST') . read_global('REQUEST_URI');
$GLOBALS['google']['useragent']=read_global('HTTP_USER_AGENT');
$google_dt = time();
google_set_screen_res();
google_set_muid();
google_set_via_and_accept();
function read_global($var) { …
Run Code Online (Sandbox Code Playgroud)

php if-statement adsense media-queries

5
推荐指数
1
解决办法
5657
查看次数

重新排列兄弟姐妹DIVS

所以我有这个HTML代码与以下CSS.

HTML

<div class="secondpostholder">
    <div class="rightsecond">
        <h1>
            <a href="<?php the_permalink();?>" alt="<?php the_title();?>" title="<?php the_title();?>">
                <?php the_title();?>
            </a>
        </h1>
        <div class="firstmetaholder">
            <p class="secondentrymeta">
            by
                <span class="secondauthormeta">
                    <?php the_author();?>
                </span>
                • <?php the_date(); ?>
            </p>
            <p class="secondentryexcerpt">
                <?php
                $content = get_the_content();
                echo wp_trim_words( $content , '30' ); ?>
            </p>
            <div class="secondreadmoreholder">
                <a class="secondreadmorea" href="<?php the_permalink();?>" alt="<?php the_title();?>" title="<?php the_title();?>">
                    Read More
                </a>
            </div>
        </div>

    </div>

    <?php $background = wp_get_attachment_image_src( get_post_thumbnail_id( $page->ID ), 'TypeOne' ); ?>

    <div class="leftsecond" style="background-image: url('<?php echo $background[0]; ?>');"> …
Run Code Online (Sandbox Code Playgroud)

html css css3 media-queries

5
推荐指数
1
解决办法
148
查看次数

在 Python Selenium 中滚动特定 DIV 元素

我正在尝试做一个简单的 Python Selenium 自动化,其中脚本将单击一个链接,该链接会在页面顶部打开一个对话框(Instagram 个人资料)。

该对话框将显示关注者列表,但不幸的是包含该列表的 UL 将仅显示前 12 个关注者(或 LI)。它由 AJAX 提供支持,可以“加载更多”关注者。

无论如何,为了模拟加载更多关注者,我尝试了以下代码:

driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/ul').send_keys(Keys.END)
Run Code Online (Sandbox Code Playgroud)

或者

driver.find_element_by_tag_name('body').send_keys(Keys.END)
Run Code Online (Sandbox Code Playgroud)

不幸的是,它不起作用。我想知道是否有正确的方法来执行此操作(向下滚动重点关注活动 div 或任何页面元素)?

下图显示了该页面的 html 结构。

在此输入图像描述

感谢您对此的帮助,非常感谢!

python selenium

5
推荐指数
2
解决办法
1万
查看次数