0

I am using the wp-job-manager plugin and i want to add an Adsense code between the job listings ( after fifth job listing ) in the page with [jobs] shortcode.

The function that outputs the jobs resides in class-wp-job-manager-shortcodes.php function output_jobs( $atts )

Because i don't know how to start to add that Adsense code to this function using action hooks or what else i need some help to make it work.

1

There's a filter for the output

    $job_listings_output = apply_filters( 'job_manager_job_listings_output', ob_get_clean() );

so, you should just do

add_filter('job_manager_job_listings_output','my_job_manager_job_listings_output');
function my_job_manager_job_listings_output($output) {
   $adsense_code = ' My adsense code';
   return $output . $adsence_code;
}
5
  • @cjbj Thank you for your reply. You give me a start point. Now i have to find a way to put the code after the fifth job listing. That should do it before $adsense_code variable; – Panos Jul 4 '16 at 15:34
  • You'd have to parse the $job_listings_output to put the adsense code exactly where you need it. Shouldn't be difficult – user1049961 Jul 4 '16 at 18:53
  • user1049961 thank you for your help. For me it seems to be difficult i am afraid. I am trying to put all these together but i need more help. I am searching and try to understand your response. – Panos Jul 4 '16 at 20:56
  • Sorry, but no one is going to write the code for you for free. You should try to do something yourself and ask for advice, or hire a developer – user1049961 Jul 4 '16 at 22:39
  • I know that i am just searching and looking for help to make this working. Otherwise if i know how to do it i won't ask anything anywhere..i am just trying to understand something that i am learning now – Panos Jul 5 '16 at 9:15

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.