Post permalink buttons going to the same post

Question

I am trying to get 2 buttons, that will display on top of an image, the image link is working fine, however, the buttons on the second post are both going to the first one? I thought just adding <a href="<?php the_permalink(); ?>"> to the buttons would work as it works fine for the image?

<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()): ?>

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/post-permalink-buttons-going-to-the-same-post/">

Post permalink buttons going to the same post</a>
0
, dizzianrhy 3 months 0 Answers 32 views 0

Leave an answer