php href指向特定帖子的超链接
在我的网站上,我有4个链接到同一页面的“程序”名称。 然而,我希望每个程序都链接到一个特定的帖子。 但是,在我的php代码中,名称和链接都由一件事控制……这是:php href指向特定帖子的超链接,php,wordpress,Php,Wordpress,在我的网站上,我有4个链接到同一页面的“程序”名称。 然而,我希望每个程序都链接到一个特定的帖子。 但是,在我的php代码中,名称和链接都由一件事控制……这是: <h3 class="sub-title"><a href="http://questtkd.com/programs/"> <?php the_title(); ?></a></h3> 在url中使用hastag。它的用途是一样的。谷歌搜索它并使用它。你在寻找方法
<h3 class="sub-title"><a href="http://questtkd.com/programs/"> <?php the_title(); ?></a></h3>
在url中使用hastag。它的用途是一样的。谷歌搜索它并使用它。你在寻找方法
get\u permalink()
它在循环中工作,以获取指向该特定帖子的链接,就像the\u title()
我能够找到主题代码的原始副本,并在记事本上打开它一样。我找到了我换过的部分-我不记得为什么或者什么时候-然后重新输入了原来的部分<代码>在url中使用hastag。它的用途是一样的。谷歌搜索它并使用它。你在寻找方法get\u permalink()
它在循环中工作,以获取指向该特定帖子的链接,就像the\u title()
我能够找到主题代码的原始副本,并在记事本上打开它一样。我找到了我换过的部分-我不记得为什么或者什么时候-然后重新输入了原来的部分<代码>
<?php
/**
* Practice Section.
*
* @package Lawyer_Landing_Page
*/
$section_title = get_theme_mod( 'pratice_section_page' );
$post_one = get_theme_mod( 'practice_post_one' );
$post_two = get_theme_mod( 'practice_post_two' );
$post_three = get_theme_mod( 'practice_post_three' );
$post_four = get_theme_mod( 'practice_post_four' );
$posts = array( $post_one, $post_two, $post_three, $post_four );
$posts = array_diff( array_unique( $posts ), array('') );
if( $section_title || $posts ){
?>
<section class="practice-area">
<div class="container">
<?php
lawyer_landing_page_get_section_header( $section_title );
$qry = new WP_Query( array(
'post_type' => array( 'post', 'page' ),
'posts_per_page' => -1,
'post__in' => $posts,
'orderby' => 'post__in',
'ignore_sticky_posts' => true
) );
if( $posts && $qry->have_posts() ){ ?>
<div class="row">
<?php
while( $qry->have_posts() ){
$qry->the_post(); ?>
<div class="col">
<div class="box">
<?php if( has_post_thumbnail() ){ ?>
<div class="icon-holder">
<?php the_post_thumbnail( 'lawyer-landing-page-practice' ); ?>
</div>
<?php } ?>
<div class="text-holder">
<h3 class="sub-title"><a href="http://questtkd.com/programs/"> <?php the_title(); ?></a></h3>
<?php
the_excerpt();
?>
</div>
</div>
</div>
<?php
}
wp_reset_postdata(); ?>
</div>
<?php
}
?>
</div>