Php Post permalink按钮转到同一个Post
我试图得到2个按钮,这将显示在一个图像的顶部,图像链接工作正常,然而,第二个帖子上的按钮都将第一个?我想只是添加Php Post permalink按钮转到同一个Post,php,wordpress,Php,Wordpress,我试图得到2个按钮,这将显示在一个图像的顶部,图像链接工作正常,然而,第二个帖子上的按钮都将第一个?我想只是添加 因为您编写了wp_reset_postdata();因此,它将post数据重置为第一个数据。所以写wp_reset_postdata();结束后;代码。因此,请将其移动或在之后再次添加它?我试过了,但似乎不起作用。首先定义专利循环post id,然后将其作为参数传递给\u permalink()方法$id=获取_id();//$title=get_the_title()the_per
因为您编写了wp_reset_postdata();因此,它将post数据重置为第一个数据。所以写wp_reset_postdata();结束后;代码。因此,请将其移动或在
之后再次添加它?我试过了,但似乎不起作用。首先定义专利循环post id,然后将其作为参数传递给\u permalink()方法$id=获取_id();//$title=get_the_title()the_permalink($id)之前;抱歉,Hemu,你在那里迷路了,我对php还很陌生。谢谢你的想法根据你的答案算出来,非常感谢!
<div class="col span_3_of_5 dev_list_items">
<?php while ($developments->have_posts()) : $developments->the_post(); ?>
<!-- This is the image link which works fine -->
<a href="<?php the_permalink(); ?>">
<div class="development-list-item" style="background-image: url('<?php the_post_thumbnail_url(); ?>');">
<div class="overlay__dev__item"></div>
<?php
$title = get_the_title();
$showhome = get_field('dev-status');
$propsArgs = array('post_type' => 'cpt-property', 'posts_per_page' => -1, 'meta_key' => 'prop_development', 'meta_value' => get_the_ID());
$props = new WP_Query($propsArgs);
$propcount = $props->post_count;
?>
<div class="dv_sldr_txt">
<p class="art-gn wht_txt"><?php echo $title; ?></p>
<?php $location = get_field('devloc_location');
if($location): $post = $location; setup_postdata($post); ?>
<p class="dev_lst_sub"><?php the_title(); ?></p>
<?php endif; wp_reset_postdata(); ?>
</div>
<?php if(!$propcount == 0 && $showhome): ?>
<table class="tb-buttons">
<!-- These are the buttons that return to the first post -->
<tr><td><a href="<?php the_permalink(); ?>" class="button button-black button-arrow-dev table-btn">View Development<span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 5.298 8.758"><defs><style>.cls-1 {fill: none;stroke: #fff;stroke-width: 1.3px;}</style></defs><path id="Path_89" data-name="Path 89" class="cls-1" d="M477,4742.781l3.919,3.919-3.919,3.92" transform="translate(-476.54 -4742.322)"/></svg></span></a></td>
<td><a href="<?php the_permalink(); ?>" class="button button-black button-arrow-dev table-btn">Make an Enquiry<span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 5.298 8.758"><defs><style>.cls-1 {fill: none;stroke: #fff;stroke-width: 1.3px;}</style></defs><path id="Path_89" data-name="Path 89" class="cls-1" d="M477,4742.781l3.919,3.919-3.919,3.92" transform="translate(-476.54 -4742.322)"/></svg></span></a></td>
</table>
</div>
<?php endif; ?>
</div>
</a>
<?php $beds = array(); $propcount = 0; endwhile; ?>
</div>
</div>
<?php endif; ?>
<?php
$args = array(
'post_type' => 'cpt-development',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
'meta_key' => 'dev_status',
'meta_value' => 'completed'
);
$developments = new WP_Query($args);
if( $developments->have_posts()): ?>