WordPress Add advertising ads befor and after content with periority [closed]

You’ll want to use add_filter() for each advertisement so you can set the priority accordingly. Example:

// Ad 1
function myprefix_ad_1( $content ) {
    $ad = 'Your ad code';
    return $ad_1 . $content; // this one is before
}
add_filter( 'the_content', 'myprefix_ad_1', 10 );

// Ad 2
function myprefix_ad_2( $content ) {
    $ad = 'Your ad code';
    return $content . $ad; // This one is after
}
add_filter( 'the_content', 'myprefix_ad_2', 20 );