I have a website called NearFile. Here is the link: https://nearfile.com/. It is a software downloading website created on WordPress. On every software page I have added a sidebar called "Other Versions" of the current software. Now I want to add a link after the "Other Versions" section like "View all versions", which will take users to another page like: website.com/post-slug/versions . But how I will do that? I have searched google about it. But I have not found any solutions.
Any Solution?
Here is the code that I have used in "Other Versions" sidebar:
<?php
$title = get_the_title();
$args = array("post_type" => "post", "title" => $title, "posts_per_page" => 10);
$my_query = new WP_Query( $args );
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>">
<div class="row soft_sm_list">
<div class="col-2">
<?php
if (get_field("software_logo")){?>
<img src="<?php the_field("software_logo");?>" width="24" height="24" alt="<?php the_title(); ?>">
<?php
}else{?>
<span class="soft_thumb"><?php the_post_thumbnail();?></span><?php
}
?>
</div>
<div class="col-10 soft_meta">
<h3 class="h6"><?php the_title(); ?> <?php the_field( "software_version" );?></h3>
</div>
</div>
</a>
<?php
endwhile;
}else{
echo "Sorry, we have only one version for this software.";
}
wp_reset_query();
?>
In this I have created a query of same post titles and shown a list of them with their versions. I have used ACF plugin to add the version of each post.