Home Forums General Issues Return ACF details from custom post type


Return ACF details from custom post type

  • Checking a checkbox of a certain post type and displaying three random post-types data.

    Basically, I have 100 custom post types which are universities. Some universities pay a premium rate for more exposure. When this happens, I have a checkbox that is ticked that is called ‘premium’. Which allows them to have a different profile. But what I would like to do, would be to display the premium profiles (3 randomly chosen ones) on the other post types that aren’t premium.

    So below Is kind of what I assume the code will look like, (in laymans terms):

    > Search custom post type’s for those that the checkbox premium has been checked.
    >> If checkbox for premium has been checked, return a random 3 and other ACF data.
    > If none are checked, then return different data.

    I know that doesn’t help much, but I have the below for displaying the premium profile details of a the current post ID below, But I want to run a query with returning random details of those that the certain ACF checkbox is ticked.

    <?php if (get_field('premium_profile') != '') {  ?>
        	Data for Premium
    <?php } else  { ?>		
        	No Data Displayed.
    <?php } ?>
    • Elliot

    • October 29, 2013 at 5:49 pm

    Hi @owenoneill

    Perhaps you could read teh docs on how to query the posts based on a custom field value?


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.