0

我的页脚链接了音乐页面上的帖子,无法弄清楚为什么它会混淆。我想像其他页面一样分开。仅供参考,我正在使用 wordpress 插件自定义字段在音乐页面上创建帖子。http://listentotheway.com/music/

音乐.php:

<?php 
/*

 Template Name: Music Page

 */

 get_header(); ?>

<div class="wrapper">
 <div id="music-content">
  <p> This is music.php </p>

   <?php

$args = array(
'post_type' => 'music'  
);

$the_query = new WP_Query( $args );

 ?>

<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<h3><a href="<?php the_permalink(); ?>"<?php the_title(); ?></h3>
<?php the_field('description'); ?> <-----This has to do with the plugin.


<?php endwhile; else: ?>

<?php endif; ?>
</div>
</div>

<?php get_footer(); ?>

样式.css:

/* music page */
#music-content {
display: block;
float: left;
}


/* Footer */

 footer {
 background-color: #eaeaea;
 display: block;
 clear: both;
  border-top: 1px black solid;
 }
4

2 回答 2

2

您只是没有关闭<a>内容中的链接标签,并且您的链接格式错误。

没有大于在锚文本>之后的关闭<a href=".."并且没有标签关闭</a>在锚文本之后。

<h3><a href="http://listentotheway.com/music/here-is-another-one/"Here is another one</h3>
YAY

<h3><a href="http://listentotheway.com/music/this-is-a-music-project/"This is a music project</h3>
This is where you find music

应该看起来更像:

<h3><a href="http://listentotheway.com/music/here-is-another-one/">Here is another one</a></h3>
YAY

<h3><a href="http://listentotheway.com/music/this-is-a-music-project/">This is a music project</a></h3>
This is where you find music

在您的 PHP 中:

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

于 2013-06-20T16:15:06.700 回答
0

请使用它,然后再试一次

<?php 
/*

 Template Name: Music Page

 */

 get_header(); ?>

<div class="wrapper">
 <div id="music-content">
  <p> This is music.php </p>

   <?php

$args = array(
'post_type' => 'music'  
);

$the_query = new WP_Query( $args );

 ?>

<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<h3><a href="<?php the_permalink(); ?>" ><?php the_title(); ?> </a></h3>
<?php the_field('description'); ?> <-----This has to do with the plugin.


<?php endwhile;?>

<?php endif; ?>
</div>
</div>

<?php get_footer(); ?>
于 2013-06-20T17:13:10.667 回答