Container based on page name using Carbon Fields

309 Views Asked by At

I would like to generate carbon field containers on pages based on their page name rather than ID, in case the ID changes in the future. The problem is, I can't figure out how to do this and have turned to the 'post_term' where clause but am still struggling to get it to work, the container is not displaying.

I have tried to use the post_term where clause as per the documentation so that I could do it based on slug or name.

->where( 'post_term', '=', array( 
   'field' => 'name',
   'value' => 'About Us',
   'taxonomy' => '',
) )

I have tried with the field and value of name About Us and slug about-us but none seem to do anything. Taxonomy is required but I don't know what to put there as it's a page and doesn't have categories?

There is no error message showing at all, it loads the site fine, it just doesn't display the container.

0

There are 0 best solutions below