'I creat a Accordion with ACf and CPT ,But when clicked on custome post type title i want to grab a data on other side of my my accordian please

enter image description here[here is the my fornt end view of accordion in that Getting Started,Identifiers,Python Plugin,Basic PHP is all custome post type titles i want make loop of that when i cicked on that titles the associated contents pf that post type is shown other side of accordion]

2


    <?php 
/* Template Name: single-course */ 
?>

<?php get_header();
?>

    enter code here

<?php


$locations = get_sub_field('locations');

// *Repeater
// bootstrap_accordion_repeater
// *Sub-Fields
// accordion_header
// accordion_content



if( have_rows('accordion_repeater') ):
    
    $i = 1; 

    echo '<div class="container-fluid " id="accordion">';
    echo '<div class="row mt-5 mb-5" id="">';
      
    //  echo '<div class="order-2   col-6 " id="best">';
    //  echo '<p>' .'dummy content '.'</p>';
    //  echo '</div>';

     echo '<div class="order-1  col-sm-12  col-md-3 col-lg-4 " id="">';
    
    while ( have_rows('accordion_repeater') ) : the_row();
        
    
        $locations = get_sub_field('locations');

    ?>

<div class="accordion" id="accordionExample">
    <div class="accordion-item">
        <h2 class="accordion-header" id="heading-<?php echo $i;?>">
            <button class="accordion-button bg-dark fw-1 text-primary text-capitalize" type="button"
                data-bs-toggle="collapse" data-bs-target="#collapseOne-<?php echo $i;?>" aria-expanded="true"
                aria-controls="collapseOne-<?php echo $i;?>">
                <?php echo get_sub_field('accordion_header'); ?>
            </button>
        </h2>
        <div id="collapseOne-<?php echo $i;?>" class="accordion-collapse collapse "
            aria-labelledby="headingOne-<?php echo $i;?>" data-bs-parent="#accordionExample">
            <div class="accordion-body">
                <?php foreach($locations as $location):?>
                <ul class="list-group">
                    <li
                        class="list-group-item active text-decoration-none shadow-2-strong p-2 mb-5 bg-light rounded  text-dark">
                        <a class="text-decoration-none  text-dark"
                            href="#goto-<?php echo $location->post_title;?>"><?php echo $location->post_title;?></a>
                        <!-- <?php echo $location->post_excerpt;?> -->
                        <!-- <?php var_dump($locations);?>  -->
                    </li>
                </ul>
                <?php endforeach;?>
            </div>
        </div>
    </div>

    <?php $i++; 
        
    endwhile; 
     echo '</div>';

     echo '</div>';
   
    
    echo '</div>';   
    echo '<div class="order-2 col-md-9 col-lg-8 col- col-sm-12 " id="best">';
    
   </div>
   <?php
   echo '</div>';
    echo '</div>';
else :
    echo '<h3>' .'we have not post yet'.'</h3>';
endif;
    echo '</div>';
    echo '</div>';
    echo '</div>';
?>
    <?php get_footer();  ?>

please tell me i show my specific custom post type content on other column bootstrap row i want to do that like show the data of accordio content actually its post type onter space of accordion that mease how i make a accordion with custome post types and i want to show data on same page with dynamic



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source