# WordPress Custom Fields with if logic

**URL:** <https://forum.pinegrow.com/t/wordpress-custom-fields-with-if-logic/11171>\
**Category:** WordPress\
**Tags:** wordpress\
**Created:** [October 22, 2025, 8:23pm UTC](https://forum.pinegrow.com/t/wordpress-custom-fields-with-if-logic/11171 "2025-10-22T20:23:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pg303](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@pg303](https://forum.pinegrow.com/u/pg303)\
**Post date:** [October 22, 2025, 8:23pm UTC](https://forum.pinegrow.com/t/wordpress-custom-fields-with-if-logic/11171/1 "2025-10-22T20:23:53Z")

</div>

I have a custom WordPress field named “post\_display\_breadcrumbs” which is a boolean, registered through custom.php.

I want to access it in my single.html to hide a `<div>` if `post_display_breadcrumbs` is false.

Here is what I currently have which does not work:

```auto
<div cms-function="code" cms-function-type="style" cms-function-code="get_post_meta( get_the_ID(), 'post_display_breadcrumbs', true ) === false" cms-function-style="display: none;">
    <div class="breadcrumbs mb-3" cms-breadcrumbs="categories" cms-breadcrumbs-item="> a:nth-of-type(1)" cms-breadcrumbs-separator="> span:nth-of-type(1)" cms-breadcrumbs-last-item="> span:nth-of-type(3)" cms-breadcrumbs-last-item-name="> span:nth-of-type(3)">
        <a href="#">Link 1</a>
        <span>&nbsp; &raquo; &nbsp;</span>
        <a href="#">Link 2</a>
        <span>&nbsp; &raquo; &nbsp;</span>
        <span>Last Link</span>
   </div>
</div>

```

Ideally what I would like to do is check if `post_display_breadcrumbs` exists & is true (`1`), then display the `<div class=”breadcrumbs”>`.

---

<div class="post-metadata">

**Author:** ![pg303](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@pg303](https://forum.pinegrow.com/u/pg303)\
**Post date:** [October 22, 2025, 9:44pm UTC](https://forum.pinegrow.com/t/wordpress-custom-fields-with-if-logic/11171/2 "2025-10-22T21:44:16Z")

</div>

I ended up just putting the PHP logic into the `single.html`

```auto
<?php if ( get_post_meta( get_the_ID(), 'post_display_breadcrumbs', true ) ) : ?>
<div class="breadcrumbs mb-3" cms-breadcrumbs="categories" cms-breadcrumbs-item="> a:nth-of-type(1)" cms-breadcrumbs-separator="> span:nth-of-type(1)" cms-breadcrumbs-last-item="> span:nth-of-type(3)" cms-breadcrumbs-last-item-name="> span:nth-of-type(3)">
    <a href="#">Link 1</a>
    <span>&nbsp; &raquo; &nbsp;</span>
    <a href="#">Link 2</a>
    <span>&nbsp; &raquo; &nbsp;</span>
    <span>Last Link</span>
</div>
<?php endif; ?>

```
