candell
Forum Replies Created
-
Forum: Hacks
In reply to: sql query help to grab post title, postmeta and featured imageSorry to be talking to myself, but I feel I am getting closer, my query returns an empty result though. Here is my latest effort
SELECT wp_posts.id, wp_posts.post_title, wp_postmeta.meta_value, wp_postmeta.meta_value FROM wp_posts, wp_postmeta WHERE wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_value = '_wp_attached_file' AND wp_posts.post_status = 'publish' AND wp_posts.post_date < NOW() AND wp_postmeta.meta_value = 'scheme.php' ORDER BY wp_posts.post_date DESCForum: Hacks
In reply to: sql query help to grab post title, postmeta and featured imageUpdate
Just noticed that the featured image is actually in the postmeta table so I modified my code to
<?php $querystr = " SELECT $wpdb->posts.id, $wpdb->posts.post_title, $wpdb->postmeta.meta_value, $wpdb->postmeta._wp_attached_file FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_date < NOW() AND $wpdb->postmeta.meta_value = 'scheme.php' ORDER BY $wpdb->posts.post_date DESC "; $theposts = $wpdb->get_results($querystr); foreach ($theposts as $pageresult) { echo '<p><img src=' .$pageresult->_wp_attached_file. ' class=alignleft />' .$pageresult->post_title. '</p>'; } ?>But this returns nothing. Looking more into the database, one post can have multiple entries in postmeta, in my case I need to pull out two rows from post meta (along with some data from posts) but it is stopping after it finds the first.
How can I modify my code to get the feaqtured image out?
Thanks
Forum: Fixing WordPress
In reply to: query wp_posts and output resultsI am getting closer, ignore the SQL at the moment as I need to figure out how to grab the name of the level above the properties to get the area.
global $wpdb; $searchresults = $wpdb->get_results( "SELECT * FROM wp_posts where post_parent ='0'" ); if ($searchresults) { global $post; foreach ($searchresults as $post) { echo "<li><a href=''>".the_title()."</a></li>"; } }but the output isn`t as I would expect, i.e. the page name is being printed outside of the list.
e.g.
Welcome
Forum: Fixing WordPress
In reply to: Multiple menus issueGot it thanks
Forum: Fixing WordPress
In reply to: Two pieces of text in the menuam I allowed to bump my own post on wordpress forums?
Works great thank you
Forum: Themes and Templates
In reply to: Newbie questionsHi
Thanks for your help, just struggling to use this though. How do I add the link_before to <?php wp_list_pages(); ?> so that the ‘<li class=”pagenav”>Pages‘ bit doesn`t show?
edit: just figured out this bit, thanks. Can you still help with the next part of my post…?
Also, I added to Settings > Permalinks > Category base the word blog, I guess I need to edit the Custom structure field to make this happen? If I do, what needs to go in here?
Thanks
Forum: Themes and Templates
In reply to: Newbie questionsbump :o)