繁体   English   中英

如何修复在 WordPress 主题中不起作用的永久链接

[英]How to fix a Permalink that is not working in WordPress theme

我有一个 WordPress “管”主题。 当我单击缩略图时,它会打开一个新页面,这是我的主页。 (它应该带我到帖子页面)但我可以手动输入帖子页面地址到 go 那里? 我怎样才能在代码中解决这个问题。 这是 image.php 中的一段代码。 我知道一些 PHP 但不是很流利,所以我不能完全连接点。

<header class="entry-header">
                <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>

                <div class="entry-meta">

                    <span class="entry-date"><time class="entry-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time></span>

                    <span class="full-size-link"><a href="<?php echo esc_url( wp_get_attachment_url() ); ?>"><?php echo esc_html( $metadata['width'] ); ?> &times; <?php echo esc_html( $metadata['height'] ); ?></a></span>

                    <span class="parent-post-link"><a href="<?php echo esc_url( get_permalink( $post->post_parent ) ); ?>" rel="gallery"><?php echo get_the_title( $post->post_parent ); ?></a></span>
                    <?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
                </div><!-- .entry-meta -->
            </header><!-- .entry-header -->

您需要链接到实际的帖子链接。

也许尝试更换

post->post_parent 

和:

post->ID

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM