Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress与get_title的问题-显示旋转木马幻灯片的标题?_Php_Html_Wordpress - Fatal编程技术网

Php Wordpress与get_title的问题-显示旋转木马幻灯片的标题?

Php Wordpress与get_title的问题-显示旋转木马幻灯片的标题?,php,html,wordpress,Php,Html,Wordpress,My page.php页面如下所示: <?php /* Template Name: CustomPageT1 */ ?> <?php get_header() ?> <div class="content"> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php // TO SH

My page.php页面如下所示:

<?php /* Template Name: CustomPageT1 */ ?>
<?php get_header() ?>
<div class="content">

<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

<?php
// TO SHOW THE PAGE CONTENTS

    while ( have_posts() ) : the_post(); ?> <!--Because the_content() works only inside a WP Loop -->
        <div class="entry-content-page">
            <?php the_content(); ?> <!-- Page Content -->
        </div><!-- .entry-content-page -->

    <?php
endwhile; //resetting the page loop
wp_reset_query(); //resetting the page query
?>



</div>
<?php get_footer() ?>
然而,实际发生的是,它不是显示页面的标题,即关于我们的,而是显示页面上旋转木马的第一张幻灯片的标题,即幻灯片一

是一个URL,如果对你们大家来说更容易的话

我尝试过其他几种显示标题的方式,例如,通过ID等,但都不起作用,它们都只产生了幻灯片一

有什么想法吗

下面是标题代码。我正在为旋转木马使用超级英雄滑块:

                <!doctype html>
                <html <?php language_attributes(); ?> class="no-js">
                    <head>
                        <meta charset="<?php bloginfo('charset'); ?>">
                        <title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :'; } ?> <?php bloginfo('name'); ?></title>
                        <link href="https://fonts.googleapis.com/css?family=Hind|Montserrat|Ek+Mukta:400,700" rel="stylesheet"> 
                        <link href="//www.google-analytics.com" rel="dns-prefetch">
                        <link href="<?php echo get_template_directory_uri(); ?>/img/icons/favicon.ico" rel="shortcut icon">
                        <link href="<?php echo get_template_directory_uri(); ?>/img/icons/touch.png" rel="apple-touch-icon-precomposed">

                        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
                        <meta name="viewport" content="width=device-width, initial-scale=1.0">
                        <meta name="description" content="<?php bloginfo('description'); ?>">

                        <?php wp_head(); ?>
                        <script>
                        // conditionizr.com
                        // configure environment tests
                        conditionizr.config({
                            assets: '<?php echo get_template_directory_uri(); ?>',
                            tests: {}
                        });
                        </script>

                    </head>
                    <body <?php body_class(); ?>>

                                            <div id="donation-boxes-header">
                                      <div class="alignleft"><a href="#"><img src="http://scottdaviesdesign.co.uk/donationboxes/wp-content/uploads/2017/05/donation-boxes-logo.png" alt="donation boxes logo"></a></div>
                                      <div class="alignright"><p><?php wp_nav_menu( array( 'container_class' => 'main-nav', 'theme_location' => 'primary' ) ); ?></p></div>
                                    </div>
                                    <div style="clear: both;"></div>

                                    <?php echo do_shortcode('[super_hero_slider slider=25]') ?>
:这是答案

滑块很可能已注册为自定义帖子类型。这意味着它在Wordpress中有自己的循环。因此,如果插件没有被很好地编码,当你在滑动条后面添加标题时,它将调用特定滑动条自定义帖子类型的标题,而不是包含滑动条的页面

如果您没有跳出循环,它将继续从该滑杆类型调用部件。这是代表他们的错误编码

只需在header.php中的滑块短代码后添加以下内容:

<?php wp_reset_postdata(); ?>
这将结束滑块循环,并继续页面循环:


此外,如果这对你有效,我会向插件作者提出一份支持票,并要求他们修复它。

旋转木马是一个Wordpress插件,在网站标题中使用一个短代码显示。我想是的,因为它包含了标题标签。我不知道问题出在哪里,否则我就不在这里了。我已经在原来的帖子中添加了标题代码。编辑了header.php,所以非常感谢。。。我将在稍后阶段安装Yoast。但我想先解决问题。对我的问题有什么想法吗?tbh,我没有看到你提到的这个小故障。。。我认为最好的办法是复习所有内容并重写你的问题。。。现在还不太清楚,它说幻灯片一是旋转木马中第一张幻灯片的标题。。它实际上应该阅读新的页面