scottiescotsman
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: search not working after db restorewould you believe it when I remover sort( $results ) it worked perfectly lol
Forum: Fixing WordPress
In reply to: search not working after db restoreyes $mo is assigned correctly but just wont list alphabetically lol so simple but wont do it lol
Oh wrong order
- This reply was modified 6 years, 6 months ago by scottiescotsman.
Forum: Fixing WordPress
In reply to: search not working after db restore<?php global $wpdb, $post; $results = $wpdb->get_results( " SELECT * FROM $wpdb->posts WHERE post_title LIKE '$mo%' AND post_type = 'movies' AND post_status = 'publish' ORDER BY post_title ASC; " ); sort( $results ); if ( $results ) { foreach ( $results as $post ) { setup_postdata ( $post ); ?>
Doesn’t work either grr
- This reply was modified 6 years, 6 months ago by scottiescotsman.
- This reply was modified 6 years, 6 months ago by scottiescotsman.
Forum: Fixing WordPress
In reply to: search not working after db restoreoops sorry
Forum: Fixing WordPress
In reply to: search not working after db restore<?php global $wpdb, $posts; $results = $wpdb->get_results( " SELECT * FROM $wpdb->posts WHERE post_title LIKE '$mo%' AND post_type = 'movies' AND post_status = 'publish'; " ); sort($results); if ( $results ) { foreach ( $results as $post ) { setup_postdata ( $post ); ?>
didn’t work grrrrrrrrr
Forum: Fixing WordPress
In reply to: search not working after db restoreok I think I got it sorted apart from sort by title…hmm
<?php global $wpdb; $results = $wpdb->get_results( " SELECT * FROM $wpdb->posts WHERE post_title LIKE '$mo%' AND post_type = 'movies' AND post_status = 'publish'; " ); if ( $results ) { foreach ( $results as $post ) { setup_postdata ( $post ); ?>
every time I try to add sort by = ‘title’ I get no results lol weird …. getting close lol
- This reply was modified 6 years, 6 months ago by scottiescotsman.
Forum: Fixing WordPress
In reply to: search not working after db restoreSELECT wp_posts.* FROM wp_posts WHERE 1=1 AND (wp_posts.ID = '86') AND wp_posts.post_type = 'page' ORDER BY wp_posts.post_date DESC
hope this helps
Forum: Fixing WordPress
In reply to: search not working after db restorethanks for the help.
changing the substring_where to just s searches the entire title of the $mo = $_GET[‘title’];.function restrict_by_first_letter( $where, $qry ) { global $wpdb; $sub = $qry->get('substring_where'); if (!empty($sub)) { $where .= $wpdb->prepare( " AND SUBSTRING( {$wpdb->posts}.post_title, 1, 1 ) = CONVERT('%s',char) ", $sub ); } return $where; } add_filter( 'posts_where' , 'restrict_by_first_letter', 1 , 2 );
think this might need tweaked…
hope this helps
- This reply was modified 6 years, 6 months ago by scottiescotsman.
Forum: Fixing WordPress
In reply to: Menu problemsfirst of all are the three menus all named differently
Forum: Fixing WordPress
In reply to: simple answer i cant getthanks guys
Forum: Fixing WordPress
In reply to: db transferhi steve,
the custom post type ‘movie’ is defined in the functions.php
p.s. it is just installed locally at the moment.thanks
Forum: Fixing WordPress
In reply to: Display taxonomy imageresolved
Forum: Fixing WordPress
In reply to: DataBase Transfersolved
Forum: Fixing WordPress
In reply to: DataBase Transferthanks for your comment, but I have figured it out.
all I had to do was delete the full db as when I loaded the backup sql it was trying to over write the existing tables. so started with a blank table and loaded the sql into that and renamed it accordingly.
I have a problem now, when I do a search for a ‘movie’ with first letter used to work but now doesn’t. ??? says cant find any but they are all there.
help please
Forum: Fixing WordPress
In reply to: add custom button to add movie pagethe functionality of the button would be to run a scraper given that I manually input the imdb title i.e. tt123456 to populate the meta boxes that I have added and want to save to my db.
thanks