• caseyctg

    (@caseyctg)


    I am trying to use the current pages title as the category_name in a query but can’t seem to get it to work.

    basically something like this:

    $postlist = get_posts(‘category_name=’.the_title().’&orderby=parent’);

    How can I store the page’s title and then use it as a parameter for the posts query?

Viewing 1 replies (of 1 total)
  • Thread Starter caseyctg

    (@caseyctg)

    Ok, figured it out..

    $categoryvariable = get_the_title($post->post_parent);
    $postlist = get_posts("category_name=$categoryvariable&orderby=parent");
Viewing 1 replies (of 1 total)
  • The topic ‘making get_posts() category_name use the pages title…’ is closed to new replies.