0

I'm creating a plugin for insert ads. I want to insert ad below the title. I'm using the theme MH Magazine Lite

Im doing my plugin like this:

function diww_pre_content($content) {

    $pre_content = 'ads_up';
    $pre_content .= $content;
    return $pre_content;
}

add_filter( 'the_content', 'diww_pre_content' );

But, this shows the ad, below the feature image (inside the post) instead of title.

enter image description here

Any idea, how can i do that?

Thanks.

1
  • That area is inaccessible without control over the theme. There's no standard hook, You could use JS if you don't have that control, but would still need to make assumptions about how the theme is built, which would make implementation theme-depended. – Jacob Peattie Feb 13 '18 at 1:45
1

You can use mh_post_header action hook to add your ads content after the post title. Check the following code snippet for help

add_action( 'mh_post_header', function() {
    echo 'Ads content goes here';
}, 5 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.