Shortcode to pull posts

UPDATE Turns out the issue was with the first page of posts. I needed to account for page 1 when calling the ajax load more. Since this is a shortcode and not a template my query vars were not passing along to the ajax call. I resolved the issue by passing the page as a … Read more

how to SELECT for the current post id?

You should be able to do that by joining data from wp_comments table as this table contains information about which comments belong to which posts $sql = $wpdb->prepare( ” SELECT meta_value FROM {$wpdb->prefix}commentmeta INNER JOIN {$wpdb->prefix}comments ON {$wpdb->prefix}commentmeta.comment_id = {$wpdb->prefix}comments.comment_ID WHERE comment_post_ID = %d AND meta_key = ‘rating’ “, get_the_ID() ); $results = $wpdb->get_results( $sql … Read more

Update query for wp_posts and wp_postmeta

The post_id column in the wp_postmeta table is a reference to the ID column in the wp_posts table. I’d suggest using the native update_post_meta() function in WordPress to update the meta data. E.g. (Post ID is 123 in this example, and we’re updating the price to 100.00): update_post_meta(123, ‘_price’, ‘100.00’); Here is the SQL equivalent: … Read more

how to insert missing tags into the posts through mySQL?

You should not modify the wordpress DB via SQL unless it is a total emergency. WordPress DB structure getting more complex with time and there are always possible intractions with plugins that you might bypass with direct SQL. What you should do is to write a small plugin that inserts the tags by calling using … Read more

Display post by click on the link

You can achieve this by using Query String. First you have to make template in your theme folder. To show post list on right side and description of post on left side I am using div with class name right and left (specify your desires css properties in those classes). To show list of posts … Read more