Displaying Custom Field on specific pages
-
Hello,
I am working on a theme for my WordPress site.
I have scrolling banner images at the top of each page. I am using ACF and CPT UI plugins.
I want to have a custom post type where I add all my banners. Each of these types will have the image, some text (which gets displayed on the banner) and the page the banner will display on. So I could have 3 banners that will display on the homepage and another banner that displays on another page. I have this working, but I have a custom post type for each page of my site. What I would prefer is to have one custom post type and have a field where I select which page i want the banner displayed on.
My thinking was I could have an if statement within my loop with something like – if( custom_field_page_id == the_current_page_id ) { display the banner }
With ACF plugin, I can have a field that gets the page link, but I am not sure how to get the current page ID or the page id from ACF.
Hopefully, this makes sense. I am new to WordPress so please let me know if this is possible/if there is a better way of doing this.
- The topic ‘Displaying Custom Field on specific pages’ is closed to new replies.