The reason why your query fails is the following.
You are finishing the loop before your cd-panel with
<?php endwhile; wp_reset_postdata(); ?>
which is correct. However, after that you are simply using
<?php the_title(); ?>, <?php the_content(); ?>
which is just a single template tag, and in your case, outputs the title of the first post of the last category you’ve queried.
The solution:
-
You have to load the post content’s via a wp ajax call (on click on that accordeon tab), or
-
open up another loop before the cd-panel, get all posts and hide/show them with css
The second is more load heavy, but not that complicated.
Related Posts:
- Calling a method from functions.php on a click of a button
- Populate dropdown with Child Pages based on Parent Page chosen
- Noscript not working as it should in wordpress site
- Time Delay a URL Redirect for Specific Page
- WordPress User Meta value variable into Google Gauge Chart
- Adding HTML Code to Replace Text in PHP
- start_lvl Ignored in Custom walker_nav_menu
- Modify previous and next text from pagination links
- WordPress Infinite Scroll without using any plugin
- WordPress Ajax always returns a 404 error
- How to use WordPress (PHP) functions in AngularJS partials files?
- Understanding WordPress child theme custom JS loading
- Javascript code inside “” in core WordPress files .php
- HTML table from shortcode with multiple parameters
- Click loads template via ajax
- javaScript in section of WP API
- How to speed up admin-ajax.php in wordpress
- Placing raw HTML inside a WordPress shortcode
- Adding tawk.to code just before body tag on functions.php file
- How do I fetch all comments per post via WP REST API?
- Shortcode content output but not in correct place
- Show post in slider
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Removing unneccessary p-tags (Not every p)
- How do I display a user’s previous orders as a select box option on a product?
- Trigger popup in a php if/else statement
- Use menu link or onClick to set a variable
- Where in PHP do I move title and meta (date) to bottom of each blog section?
- Converting HTML Template to WordPress Theme
- How to store data from multiple forms using ajax and php
- Use DOMDocument with ob_start breaks my HTML code
- JS file work only in index page
- How to change redirection route to a php page for making it only accessible by logged-in members?
- dynamic dependent select dropdown
- Ajax load more button for comments wordpress
- parts of url disappear when using # inside href=”” [closed]
- Add .htm extention to a custom taxonomy
- How to make modifications only to certain elements of an HTML string on the server-side?
- Add Codepen animation as Preloader to WordPress
- Widget back end radio button issue
- HTML escaping data with ajax requests
- Override user-edit.php to design own profile page
- Why i can’t get custom fields value or post ID via Ajax?
- Adding function to child theme’s function.php
- How to reference PHP in Javascript
- How to use the checked() function to check for a non-empty var
- Calling function in loop causes repeat data
- Link to page with posts of specific type
- Is it possible to isolate and use WordPress functions outside of wordpress
- how to changes mobile menu toggle breakpoint in WordPress
- Cascading dropdown select search based on Parent Page & Child Page
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- html form: redirect page after form completes submit function and posts data
- Cannot find the php_ini configuration file to find my error log to see why my code is not working
- Search bar for wp menu
- Executing php on button press
- Add other class content with reference class value
- PHP function for horizontal Woocommerce thumbnails and badges
- Gutenberg block don’t save rich text content
- Using Google Analytics in an enqueued JS file
- HTML comment cause issue in functions.php script root
- separate list of programs in html/javascript coming from php
- Remove span tags from WooCommerce Downloads page
- Trying to add some custom text into WordPress Post title via function.php
- How do I disable cache for a certain page?
- Update $wpdb query with AJAX
- WordPress Slider is not working
- Using Javascript On Page – Header and Footer Now Missing
- Adding extra data to shortcode attributes and pass it to JS with wp_localize_script
- Show subcategory name selected in specific category woocoommerce
- How to center all text body in single.php at once?
- sessionStorage saves input value in browser but it is not loaded in the form field
- Collapsible menu on post sidebar only expands and does not collapse
- How do I make comment-reply-button with that takes to comment reply form on click
- How can I get my pagination loop to display the correct number of total pages?
- How to call a function from functions.php with ajax?
- Custom Post type Ajax search results
- WordPress load javascript file if something… (after the page is loaded)
- wordpress all post filter by year
- Target a specific container to style on WordPress storefront theme
- Can’t get_users info by using json_encode
- scroll scrpit to particular button position to next id when click button
- Bootstrap Carousel Indicators Won’t Cycle On Custom WordPress Theme
- Show post/page into div using function
- Find the method which AJAX GET calls
- Display text of price (minus 20%) on every product page in a sentence.
- Where to find the html for WordPress site? [closed]
- I need help implement a Javascript code into the PHP file
- WordPress HTML Helper
- Help with my first Metabox helper class
- Cant get theme to change footer color through theme customizer
- Trouble figuring out how to get my button to submit comment
- how can I make content from a plugin hidden when user is logged in? [duplicate]
- How to hide .js files on wordpress website using php or wp plugins or any? [closed]
- Sorting Problem
- Add multiple HTML attributes to an Elementor button
- Load wp_editor on button click
- Slick slider not working on wordpress
- Show Login Errors In WordPress/Elementor (Code “works”, but breaks site)
- hiddenQuestions.find is not a function