Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter eyeofthenyte

    (@eyeofthenyte)

    You were right. I was just messing up with the syntax and arguments within the wp_get_attachment_url. Thanks again! Appreciate your help and enjoy the plugin as well.

    Thread Starter eyeofthenyte

    (@eyeofthenyte)

    I am trying to make a URL for either the DFI or the normal featured image. I know that I need to reference the the ID but am uncertain how to generate the rest of the URL. Place it into the $thumb_url variable below so it goes to my websocket appropriately.
    The best I achieved was getting a “default.jpg” at one point but it was essentially just a default missing image icon.

    
        if ( $new_status != 'publish' || $old_status == 'publish' || $post->post_type != 'post')
            return;
     
        $webhookURL = get_option('discord_webhook_url');
        $id = $post->ID;
    
        //$author = $post->post_author;
        //$authorName = get_the_author_meta('display_name', $author);
        $postTitle = $post->post_title;
        $permalink = get_permalink($id);
        $thumb_url = "default-or-featured-image-url";
        $description = $post->post_excerpt;
        $timestamp = $post->post_date;
    
        $postData = json_encode([
        "content" => "@here A dragonet just dropped off a new parchment: ",
        //"avatar_url" => "image url here",
        // Embeds Array
        "embeds" => [
            [
                "title" => $postTitle,
                "type" => "rich",
                "description" => $description,
                "url" => $permalink,
                "timestamp" => $timestamp,
                "color" => hexdec( "3366ff" ),
                "footer" => [
                    "text" => "EoN Creations  -  https://eoncreations.com",
                    "icon_url" => "https://eoncreations.com/wp-content/uploads/2020/02/cropped-EggOracle-180x180.png"
                ],
                "image" => [
                    "url" => $thumb_url
                ],
                "thumbnail" => [
                    "url" => $permalink
                ]
                ]
            ]   
        ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
    
    Thread Starter eyeofthenyte

    (@eyeofthenyte)

    Ahh I see. I guess I’m more looking to generate a link for said image. I’ll give the snippet a try. I’m pretty new to all of this but I think that’s in the media.php file. Taking a stab in the dark haha. Thanks for your assistance so far.

    Thread Starter eyeofthenyte

    (@eyeofthenyte)

    Well, It definitely looks like I merged some things and didn’t quite go far enough in other places. I ended up finding some more info and things are working now.

Viewing 4 replies - 1 through 4 (of 4 total)