
How to display results of code before the_content in wordpress?
- or -
Post a project like this1481
£30(approx. $40)
- Posted:
- Proposals: 8
- Remote
- #3379106
- Awarded
Website Developer, Graphic Designer, Transcriber, Content writer, CAD Expert, Python Developer, Photo Editor, Web Scrapper, JAVA developer, Android developer, Wix/Shopify Expert,

Expert in WordPress, WooCommerce, Shopify, OpenCart & PrestaShop | 10 Years in Ecommerce Development

Website Designer and Developer in PHP,Wordpress,Freekore Framework,Codingnigter,CSS,Jquery and Javascript
182838225437787855822524633240943963441924673921726988




Description
Experience Level: Entry
I have code which tests to see if we are on a page with the category term of case-studies and then displays a jQuery slider using the ACF gallery field. This technically works fine as you can see here:
https://www.immersivereality.co.uk/test-case-study/
But its appearing at the top and no matter where I add it in the single.php file its either right at the top or the bottom. I want to add add it in at the start of the content so it appears underneath the Title and meta data.
I have seen this code:
function prefix_add_content ($content){
$before = "This comes before the content.";
$after = "This comes after the content (like my Podcast badge).";
$content = $before . $content . $after;
return $content;
}
add_filter ('the_content', 'prefix_add_content');
which looks good but how do I inject the reults of the ACF code into the $before variable?
Regards,
David
https://www.immersivereality.co.uk/test-case-study/
But its appearing at the top and no matter where I add it in the single.php file its either right at the top or the bottom. I want to add add it in at the start of the content so it appears underneath the Title and meta data.
I have seen this code:
function prefix_add_content ($content){
$before = "This comes before the content.";
$after = "This comes after the content (like my Podcast badge).";
$content = $before . $content . $after;
return $content;
}
add_filter ('the_content', 'prefix_add_content');
which looks good but how do I inject the reults of the ACF code into the $before variable?
Regards,
David

David R.
100% (8)Projects Completed
8
Freelancers worked with
8
Projects awarded
33%
Last project
13 May 2021
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
Did you try to edit in the single.php file?
995991
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies