rjt1985
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] How to set the Sidebar?Any help with this would be massively appreciated.
It seems like it is always picking up the default / archive sidebar rather than picking up a one that I specify. I’ve even tried copying my theme’s page.php file and calling it woocommerce.php and swapping out the loop for <?php woocommerce_content(); ?> but that still results in the same sidebar appearing no matter what.
Surely there must be a way to hardcode which sidebar I want to display?
Nevermind, I found another solution.
Add this bit marked “new line” before $imported++:
} add_post_meta( $post_id, 'raw_import_data', json_encode( $twitter_raw ) ); // NEW LINE (change 1001 to the image ID): set_post_thumbnail( $post_id, 1001 ); $imported++; }
OK Beau, I’m sorry to keep pestering, because to be honest, I have no idea what I’m doing.
update_post_meta( $the_imported_post_id, '_thumbnail_id', 718 );
I’ve just put the above code in, with 718 being the attachment id of my image. Is that correct, because it won’t work.
Yeah, that’s what I’m looking for. So, where would that go in the importer code?
I’m just setting a single image across all posts that the Twitter importer brings in.
Forum: Plugins
In reply to: Adding a featured image to an automated feed post?Can anyone help with this? I’m thinking it’ll be something like telling the below code that for these posts the_post_thumbnail(); = imgID, but I’m not sure how.
// Apply selected category $post_category = array( $this->get_option( 'category' ) ); // Clean up content a bit $post_content = $post->text; $post_content = $wpdb->escape( html_entity_decode( trim( $post_content ) ) ); // Handle entities supplied by Twitter if ( count( $post->entities->urls ) ) { foreach ( $post->entities->urls as $url ) { $post_content = str_replace( $url->url, $url->expanded_url, $post_content ); } } // Any hashtags used in a tweet will be applied to the Post as tags in WP $tags = $this->get_option( 'tags' ); if ( preg_match_all( '/(^|[(\[\s])#(\w+)/', $post_content, $tag ) ) $tags = array_merge( $tags, $tag[2] ); // Add HTML links to URLs, usernames and hashtags $post_content = make_clickable( esc_html( $post_content ) ); // Include geo Data (if provided by Twitter) if ( !empty( $post->geo ) && 'point' == strtolower( $post->geo->type ) ) $geo = array( 'lat' => $post->geo->coordinates[0], 'long' => $post->geo->coordinates[1] ); else $geo = array(); // Get a GUID from Twitter, plus other important IDs to store in postmeta later $user = $this->service->get_token()->get_meta( 'username' ); $twitter_id = $post->id_str; $twitter_permalink = "https://twitter.com/{$user}/status/{$twitter_id}"; $in_reply_to_user_id = $post->in_reply_to_user_id; $in_reply_to_screen_name = $post->in_reply_to_screen_name; $in_reply_to_status_id = $post->in_reply_to_status_id; $post_author = $this->get_option( 'author' ); $post_status = 'publish'; $twitter_raw = $post; // Build the post array, and hang onto it along with the others $this->posts[] = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'post_category', 'tags', 'twitter_id', 'twitter_permalink', 'geo', 'in_reply_to_user_id', 'in_reply_to_screen_name', 'in_reply_to_status_id', 'twitter_raw' ); } } function insert_posts() { global $wpdb; $imported = 0; $skipped = 0; foreach ( $this->posts as $post ) { extract( $post ); if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->postmeta} WHERE meta_key = 'twitter_id' AND meta_value = %s", $twitter_id ) ) || $post_id = post_exists( $post_title, $post_content, $post_date ) ) { // Looks like a duplicate $skipped++; } else { $post_id = wp_insert_post( $post ); if ( is_wp_error( $post_id ) ) return $post_id; if ( !$post_id ) continue;
Yeah, I’m figuring it out thanks. Really appreciate the help.
On a final, seperate note, do you know what I need to look at in the code to set a featured image for the Twitter posts (the same featured image for each post)?
Many thanks,
R
Do you know anyone who might be interested in putting together something for YouTube?
It would be really useful to me (so I don’t have to update my website everytime I post a new video), but I’m not a coder at all. I can understand very basic php and html, but actually coding something is beyond me at the minute.
ps. are you planning on doing anything with Pinterest or YouTube?
Forum: Plugins
In reply to: [Keyring Social Importers] There was a problem connecting to Twitter…Scratch that, I’ve just seen your reply.
Thanks again.
Yeah that would be great, if you did add some filters. If you look at a plugin called Instagrate, they allow you to choose what you want your posts to look like, where you want the instagram image to appear, what you want the title to say etc. Something like that would be great for your plugin.
Forum: Plugins
In reply to: [Keyring Social Importers] There was a problem connecting to Twitter…Cheers mate. Let me know your thoughts on my other queries when you get a second.
Forum: Plugins
In reply to: [WP RSS Multi Importer] Title and excerpts cut off…I have deactivated the plugin temporarily. It seems that Pinterest’s RSS feed automatically truncates the title of the pin, which is massively irritating.
Is there any way around this (i.e. a way to get a fuller version of a Pinterest RSS)?
Forum: Plugins
In reply to: [Keyring Social Importers] There was a problem connecting to Twitter…Hi Beau. The update has fixed my issue! ?? Although it potentially could have been to do with me not setting a callback URL (?).
Anyway, it’s working now. I have some additional questions if you’ve got some spare minutes to have a read through. I’ve posted them in a new thread on the support forum.
Forum: Plugins
In reply to: [Keyring Social Importers] There was a problem connecting to Twitter…Having the same problem when I add Instagram credentials in Keyring. Keyring says that it’s saved the details, but when I view the connections I’ve made it just shows this screen: https://dev.rjthompsonmusic.com/wp-content/uploads/2013/04/Screen-Shot-2013-04-07-at-22.00.46.png
I’m guessing this is some kind of bug with Keyring?
Forum: Plugins
In reply to: [Default Featured Image] Category Featured Image not working fullyI’ve just tried that, and it’s still showing up with the same problem.
Any ideas?
Thanks for the help by the way. Really appreciate it.