Php wordpress博客标题url

Php wordpress博客标题url,php,wordpress,blogs,Php,Wordpress,Blogs,我正试图使我的博客标题从预览区链接到全文,这样标题应该具有与“阅读更多”按钮相同的功能。博客是以砖石结构布局的,我使用的是themeforest主题 这是博客页面 我相信这就是控制布局的php代码——希望它能有所帮助 对不起,我是新来的 我试过使用';但所有这些都只是生成了一个包含“.get_permalink.”的坏url 多谢各位 <?php if ( '' != get_the_title() ): ?> <h5 c

我正试图使我的博客标题从预览区链接到全文,这样标题应该具有与“阅读更多”按钮相同的功能。博客是以砖石结构布局的,我使用的是themeforest主题

这是博客页面

我相信这就是控制布局的php代码——希望它能有所帮助

对不起,我是新来的

我试过使用';但所有这些都只是生成了一个包含“.get_permalink.”的坏url

多谢各位

                    <?php if ( '' != get_the_title() ): ?>
        <h5 class="post-title"><?php the_title(); ?></h5>
    <?php endif ?>
    <?php if (has_post_format('link')): ?>
        <a href="<?php echo $nz_link_url; ?>" title="<?php echo __("Go to", TEMPNAME).' '.$nz_link_url; ?>" target="_blank"><?php echo __("Read more", TEMPNAME); ?><span class="icon-arrow-right9"></span></a>
    <?php else: ?>
        <a href="<?php the_permalink(); ?>" title="<?php echo __("Read more about", TEMPNAME).' '.get_the_title(); ?>" rel="bookmark"><?php echo __("Read more", TEMPNAME); ?><span class="icon-arrow-right9"></span></a>
    <?php endif ?>
<?php endif; ?>

您只需要将h5标题包装在代码片段第37行的锚定标记中。要更改的具体代码为:

新答案 或者从您的代码中,尝试:

<a href="<?php echo $nz_link_url; ?>" title="<?php echo __("Go to", TEMPNAME).' '.$nz_link_url; ?>">
    <h5 class="post-title"><?php the_title(); ?></h5>
</a>
旧答案 您可能需要更新CSS以反映H5前面的锚定标记

完整代码


请输出整个while循环。所有操作都完成了,对此表示抱歉。将while循环替换为修改后的while循环,但由于某些原因,我似乎无法使其工作。。。我不明白为什么它不起作用,你所说的一切都有道理。lol:/这就是答案,所以如果这个答案不起作用,那么你编辑了错误的文件。Try single.php这是我的single.php中的所有内容。我已经检查了这两个文件,但找不到blog post title类的引用。我唯一能找到它的地方是shortcodes.php,这就是我在这里发布的内容。Thanks@Nicole正如McNab所指出的,您可能只是编辑了错误的文件,现在弄糊涂了。如果page.php中的代码更改不成功,请尝试更改archive.php中的代码。好的,谢谢,我会接受答案,因为我知道它是正确的,尽管它对我不起作用谢谢你抽出时间。
<a href="<?php echo $nz_link_url; ?>" title="<?php echo __("Go to", TEMPNAME).' '.$nz_link_url; ?>">
    <h5 class="post-title"><?php the_title(); ?></h5>
</a>
if ( '' != get_the_title() ){
    $output .= '<a href="'.get_permalink().'"><h5 class="post-title">'. get_the_title() .'</h5></a>';
}
 while($recent_posts->have_posts()) : $recent_posts->the_post();

                $output .= '<div class="post format-'.get_post_format().'" data-grid="ninzio_01">';

                    $output .= '<div class="post-wrap nz-clearfix">';

                        if (get_post_format() == 'image') {
                            $values = get_post_custom( $post->ID );
                            $nz_image_url = isset($values["image_url"][0]) ? $values["image_url"][0] : "";

                            if (!empty($nz_image_url)) {
                                $output .='<a class="nz-more" href="'.get_permalink().'">';
                                    $output .= '<div class="nz-thumbnail">';
                                        $output .= '<img src="'.$nz_image_url.'" alt="'.get_the_title().'">';
                                        $output .= '<div class="ninzio-overlay"></div>';
                                        $output .= '<div class="post-date"><span>'.get_the_date("d").'</span><span>'.get_the_date("M").'</span></div>';
                                    $output .='</div>';
                                $output .='</a>';
                            }

                        } else {
                            if (has_post_thumbnail()) {
                                $output .='<a class="nz-more" href="'.get_permalink().'">';
                                    $output .= '<div class="nz-thumbnail">';
                                        $output .= get_the_post_thumbnail( $post->ID, $size );
                                        $output .= '<div class="ninzio-overlay"></div>';
                                        $output .= '<div class="post-date"><span>'.get_the_date("d").'</span><span>'.get_the_date("M").'</span></div>';
                                    $output .='</div>';
                                $output .='</a>';
                            }
                        }



                        $output .= '<div class="post-body">';

                                if ( '' != get_the_title() ){
                                    $output .= '<a href="'.get_permalink().'"><h5 class="post-title">'. get_the_title() .'</h5></a>';
                                }

                                if ($excerpt == "true") {
                                    $output .= '<div class="post-excerpt">'.nz_excerpt(95).'</div>';
                                }

                                $output .='<a href="'.get_permalink().'" title="'.__("Read more about", TEMPNAME).' '.get_the_title().'" rel="bookmark">'.__("Read more", TEMPNAME).' <span class="icon-arrow-right9"></span></a>';

                        $output .= '</div>';

                    $output .= '</div>';

                $output .= '</div>';