Support

Account

Home Forums General Issues Admin Styling > Relationship Fields

Solved

Admin Styling > Relationship Fields

  • This may not be the place for this question, but maybe someone has some experience with this.

    We are looking to help identify some expired posts/events in the admin area of a post. We are using a relationship field to pull in Events from an event plugin and it works great, however it doesn’t remove expired events. No problem, but we want to make it easier to identify the events that have passed by doing a query and getting the IDs of past events, then styling that entry with a faded red background.

    We were able to do something similar with another CPT/ACF field, but this was on the main post listing and not inside the editor.

    Here is the HTML that is produced for this particular section:

    <div class="relationship_right">
         <ul class="bl relationship_list">
              <li>
    	       <a href="http://localhost/future-event/"><span class="relationship-item-info"></span>Future Event<span class="acf-button-remove"></span></a>
    	       <input type="hidden" name="fields[field_51acc7b4e46bf][]" value="467" />
              </li>
              <li>
                   <a href="http://localhost/event-url/"><span class="relationship-item-info"></span>Another future event<span class="acf-button-remove"></span></a>
    	       <input type="hidden" name="fields[field_51acc7b4e46bf][]" value="569" />
    	   </li>
          </ul>
    </div>
    <!-- / Right List -->

    Any suggestions are appreciated.

  • Hi @nathand

    The relationship field has a filter which you can use to customize the HTML of each result!

    You can read about this filter here:
    http://www.advancedcustomfields.com/resources/tutorials/customize-the-relationship-field-list-htm/

    This will allow you to add the customized CSS classes to the items

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

The topic ‘Admin Styling > Relationship Fields’ is closed to new replies.

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.