sql change for page map
-
I am looking to edit a page map function for my theme and I thought I had an idea how to make it work but it is not working so I could use some assistance.
The line I believe I need to change is
$pageslist = $wpdb->get_results(“SELECT ID, post_title FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_type = ‘page’ ORDER BY post_title “);
I need it to also list post from my writing category (id 35)
So I ran a query in phpmyadmin in an attempt to do this, but I am getting syntax errors and Im not really sure what to fix. My guess would be the nested Select statement is not correct. It’s been a while since Ive learned sql so I forget some of the ways to handle things.SELECT ID, post_title FROM lis_posts WHERE post_status = ‘publish’ AND post_type = ‘page’ OR { post_type = ‘post’ AND {SELECT parent FROM ’lis_term_taxonomy’ WHERE ’parent’ = ’35’ } } ORDER BY post_title
I suppose when I get the proper syntax, ill have to set it up in the them format with the $wpdb-> parts instead of the LIS_ prefix?
- The topic ‘sql change for page map’ is closed to new replies.