wethecom
Forum Replies Created
-
Forum: Plugins
In reply to: [Discordance] featured image thumbnail not showingthanks…
where are the %thumbnail% handled in the code? where are they set? what files .. i cant seem to see where thats handledForum: Plugins
In reply to: [Discordance] featured image thumbnail not showingim over here if you wanna talk
https://discord.gg/xFUhrGNPForum: Plugins
In reply to: [Discordance] featured image thumbnail not showingyou can ignore all the mysql stuff that custom stuff to keep up with new videos from youtube channels
Forum: Plugins
In reply to: [Discordance] featured image thumbnail not showingi built a youtube channel scraper that posts new videos to your wordpress
it runs from a server c# project that acts like a cron job to execute webpages that scrapes youtube…
now i want to post the scraped news to twitter and any social i can.i want to build a new ifttt system of my own
thats some background to know where im comming from
Forum: Plugins
In reply to: [Discordance] featured image thumbnail not showingin my situation its a rss feed from youtube.. and the image is read from the rss feed. so i place it in the json.. ..
not sure what 100% the questionif you already have a post with a id and image try this
<?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘single-post-thumbnail’ ); ?>
<div id=”custom-bg” style=”background-image: url(‘<?php echo $image[0]; ?>’)”></div>
<?php endif; ?>install chrome extension grepper to get code snippets
Forum: Plugins
In reply to: [Discordance] featured image thumbnail not showingi ended up writing my own if you want some hints
$my_post = array(
‘post_title’ => $author . “-” . wp_strip_all_tags($media_title),
‘post_content’ => $author . “-” . substr($media_title . ” ” ,0, 20) . ”
” . $link . ”
” .
$media_description,
‘post_status’ => ‘publish’,
‘post_author’ => 1,
‘post_category’ => array(8, 39),
);
//the content is a filter name used in wordpress to pre porccess video and image embeds and tags etc
// apply_filters( ‘the_content’, $content );
// Insert the post into the database
$mypostid = wp_insert_post($my_post);
$post_link = get_permalink($mypostid);
echo “<br> $post_link and id ” .$post_link.” and ” .$mypostid . “<br>”;
// echo $media_thumbnail . “<br>”;
Generate_Featured_Image($media_thumbnail, $mypostid, $id . “.jpg”);
$sql = “INSERT INTO xxx.youtube (videoid,title,thumbnail,descript,starcount,satisticsviews,link,channelid,author,published,updated,stars)
VALUES (‘$id’, ‘$media_title’, ‘$media_thumbnail’, ‘$media_description’, ‘$count_star_rating’, ‘$media_satistics_views’ , ‘$link’ , ‘$yt_channelid’, ‘$author’, ‘$published’, ‘$updated’,’$count_star_count’)”;$date = new DateTime();
$mytimestamp = $date->getTimestamp();
//##################discord post//2021 current working model
$url = “https://discord.com/api/webhooks/xxx”;
// security issue with this being false not tested ?? curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$hookObject = json_encode([
/*
* The general “message” shown above your embeds
*/
“content” => “”,
/*
* The username shown in the message
*/
“username” => “Auditors United”,
/*
* The image location for the senders image
*/
“avatar_url” => “https://media.discordapp.net/attachments/749633007484272701/821860322364489779/batman-icon1.png”,
/*
* Whether or not to read the message in Text-to-speech
*/
“tts” => false,
/*
* File contents to send to upload a file
*/
// “file” => “”,
/*
* An array of Embeds
*/
“embeds” => [
/*
* Our first embed
*/
[
// Set the title for your embed
“title” => “$media_title”,// The type of your embed, will ALWAYS be “rich”
“type” => “rich”,// A description for your embed
“description” => “$author”,// The URL of where your title will be a link to
“url” => “$post_link”,/* A timestamp to be displayed below the embed, IE for when an an article was posted
* This must be formatted as ISO8601
*/
“timestamp” => “”,// The integer color to be used on the left side of the embed
“color” => hexdec( “FFFFFF” ),// Footer object
“footer” => [
“text” => “”,
“icon_url” => “https://pbs.twimg.com/profile_images/972154872261853184/RnOg6UyU_400x400.jpg”
],// Image object
“image” => [
“url” => “$media_thumbnail”
],// Thumbnail object
“thumbnail” => [
“url” => “”
],// Author object
“author” => [
“name” => “”,
“url” => “https://auditorsunited.org/a/”
],// Field array of objects
]
]], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
$headers = [ ‘Content-Type: application/json; charset=utf-8’ ];
$POST = [ ‘username’ => ‘Testing BOT’, ‘content’ => ‘Testing message’ ];$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $hookObject);
$response = curl_exec($ch);