Frage

I'm developing a theme in a local machine and migrating it to a production server. To keep things in sync, i'm trying to avoid any queries of specific ID's

On the homepage, i'm trying to query the top 3 pages (by menu_order) from a parent page (NOT the homepage). It works perfectly with the hardcoded ID, but i'm stumped trying to figure out a way to do this without the ID. Seems like I should be able to use the slug, but I can't figure it out.

Here's the code i'm working with:

$args = array(
'post_type' => 'page',
'posts_per_page' => 3,
'post_parent' => '74',
'orderby' => 'menu_order',
);
query_posts($args);

So rather than 'post_parent' => '74' I want to use the page slug (e.g. 'books'). Any ideas?

This question seems promising, but as others commented, I'd also like to avoid direct DB queries and the second suggestion didn't work working.

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit wordpress.stackexchange
scroll top