I'm dynamically generating my category post by getting the Page title and match it with the category name. The category I'm posting sometimes has a subcategory now I need to separate this subcategory by groups. I'm using this code.
<ul>
<?php
global $post;
$post_slug = get_the_title();
$args = array ( 'category_name' => $post_slug, 'posts_per_page' => -1, 'orderby' => title, 'order' => ASC);
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<li>
<strong><?php the_title(); ?></strong>
<?php the_content(); ?>
</li>
<?php endforeach; ?>
</ul>
I need to call my category only by using the page title. since I'm using a template that post different category and controlling it by name title of the page. Not quite sure if I can convert that to category => ID
Please see link here for the explanation and mock
Found this thread not sure if its going to fit on what I did? also this one