Christian Westerink
Forum Replies Created
-
Forum: Themes and Templates
In reply to: return all pages of certain templateHi Candell,
Thanks for your help, but don’t know how to implement in website…. Can you give some information on what kind of query I should use, which handles the myquery?
Like where do I need to paste this? Instead of the
<?php foreach ($recentposts as $post)
I should run:
<?php foreach ($myquery as $post)And how to define that meta_key is from postmeta and post_type is from just post?
Thank you for your help!
Forum: Themes and Templates
In reply to: return all pages of certain templateHey candell! You resolved the issue? How did you do that. I am using this code to do the same, but can’t get it to work…
<?php $today = current_time('mysql', 1); $howMany = 8; //Number of posts you want to display if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = '_wp_page_template' AND $wpdb->postmeta.meta_value = 'page.php' AND $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_modified != $wpdb->posts.post_date AND $wpdb->posts.post_type='page' ORDER BY $wpdb->posts.post_modified DESC LIMIT $howMany")): ?> <?php foreach ($recentposts as $post) { if ($post->post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);?> <ul><a href="<?php echo get_page_link($page->ID) ?>"><?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?> <h3><?php echo the_title(); ?></h3></a></ul> <?php } ?> <?php endif; ?>I don’t get any results here. Problem is in the part:
WHERE $wpdb->postmeta.meta_key = '_wp_page_template' AND $wpdb->postmeta.meta_value = 'page.php'Because when I fill in ‘default’ in stead of ‘page.php’ it gives the home page 8 times.
What goes wrong?
I try to retrieve al pages with page.php as template (this is default template) on the homepage of: http://www.scheepvaartinbeeld.nl/
The code above runs at the block Laatst bijgewerkt G: test
Can you help me?