Image placed with username in recent post of WordPress
Take a look at filter_input(). It allows you to sanitize and validate GET/POST variables whether they exist or not. If no variable in that scope exists it will be set to FALSE/NULL which means all you have to do is set it to a variable and ensure it has a value.

$tempPart = filter_input( INPUT_GET, 'including_template_part', FILTER_SANITIZE_STRING );
$part = filter_input( INPUT_GET, 'load_part', FILTER_SANITIZE_STRING );
if( $tempPart &amp;&amp; $part ) {


You should avoid internal comments. Internal comments adds clutter to your code and if overused can make your code difficult to read. If your code is self documenting most comments become unnecessary. Anything else should be limited to doccomments.

Ternary statements are good if used properly, but they can become difficult to read if they get too large or if you nest them. Try to keep your ternary statements short and uncomplicated. Here for instance, it is not even necessary. explode() will return an array with the string as the only element if the delimiter does not exist. So you can just call explode() immediately to the same effect.

$params = explode( ',', $params );


You should avoid using exit or die() to force your program to stop. It is inelegant. If you must stop execution use a return or throw an error.

There is a principle called the arrow anti-patern. It dictates that you should avoid having heavy/unnecessary indentation in your code to aid in legibility. To avoid violating it you should return early from your statements or refactor them so that only small portions of code are indented. Returning early sometimes also makes else statements unnecessary. If we reverse that first if statement we can return early allowing us to remove an entire level of indentation from our function.

if( ! $tempPart || ! ! $part ) {
    return FALSE;//or throw error
}

//rest of function here...


Your second function has a $numberposts argument that is unused. You immediately create an array with the same values though. If you need to do something like this you should either immediately inject it that way or you can use compact() to the same effect.

$args = compact( 'numberposts' );


Now, as to your problem with the images. Since they are originating on another part of your domain, I would hazard to guess that the path to said images is not being updated for the new domain path. This means that you will need to somehow modify the path you are given to reflect the differences. Seen as none of the code you provided has images in it I have no idea what the culprit is.