php href hyperlink to specific post

on my site, i have 4 “Program” names that link to the same page.
however instead, i want each program to link to a SPECIFIC POST.
BUT, in my php code, the names are and link are all controlled by one thing…this:

    <h3 class="sub-title"><a href="http://questtkd.com/programs/"> <?php the_title(); ?></a></h3>

how do I change that href so that each sub-title will go to a specific post?
here is the code:

    <?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>

Read more here: php href hyperlink to specific post

Leave a Reply

Your email address will not be published. Required fields are marked *