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. Commented Feb 13, 2018 at 1:45

1 Answer 1

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 and acknowledge you have read our privacy policy.

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