0

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.

2
  • Hi, welcome to StackOverflow. Can you please add the code you used to add the "Other Version" into the right sidebar?
    – Junaid
    Commented Apr 2, 2020 at 2:16
  • Hey I have added the code in my question as StackOverflow doesn't allows to add more than 500 characters. You can check it from there. Commented Apr 3, 2020 at 5:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.