Wordpress get permalink of a first page of a specific page template -


i wonder if possible in wordpress permalink of first page of specific page template.

for example, have couple of custom page templates.

in index page have anchors 1 should load first page of default (text) page template , second should load services template example.

is possible achieve in wordpress?

if yes, solution?

thank in advance!

there aren't wordpress functions (that know of) can write own query $wpdb. if had template filename of "template-faq.php" , wanted permalink of first page used template this:

<?php global $wpdb; /* post ids of pages using "template-faq.php" */ $faq_pages = $wpdb->get_results("select `post_id` $wpdb->postmeta `meta_key` ='_wp_page_template' , `meta_value` = 'template-faq.php' ", array_a); /* permalink using post id of first page in results */ $faq_permalink = get_permalink($faq_pages[0]['post_id']); ?> 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -