# How to correctly implement custom php

**URL:** <https://forum.pinegrow.com/t/how-to-correctly-implement-custom-php/7767>\
**Category:** Questions\
**Created:** [February 23, 2023, 10:31am UTC](https://forum.pinegrow.com/t/how-to-correctly-implement-custom-php/7767 "2023-02-23T10:31:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hannah](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/hannah/32/5047_2.png) [@Hannah](https://forum.pinegrow.com/u/Hannah)\
**Post date:** [February 23, 2023, 10:31am UTC](https://forum.pinegrow.com/t/how-to-correctly-implement-custom-php/7767/1 "2023-02-23T10:31:34Z")

</div>

In my project, I have created a custom template where I showcase my previous projects. At the top of this template, there is a feature list where I state the features used within the project.

 ![Screenshot 2023-02-23 at 10.15.57](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/d/d085fc167a9556bfbe18acbc71a64625c714a0ce.png)

I have made each element editable using ACF but I know that the number of features used in each project will vary. I don’t want items in the list to be visible if they are not used. I went to the ACF documentation and found this for a basic implementation:

```auto
<?php if( get_field('field_name') ): ?>
    <p>My field value: <?php the_field('field_name'); ?></p>
<?php endif; ?>

```

And this for a loop:

```auto
<?php 

$fields = get_field_objects();

<?php if( $fields ): ?>
    <ul>
    <?php foreach( $fields as $field ): ?>

        <?php if( $field['value'] ): ?>
            <li><?php echo $field['label']; ?>: <?php echo $field['value']; ?></li>
        <?php endif; ?>

    <?php endforeach; ?>
    </ul>
<?php endif; ?>

```

My feature list structure looks like this:

```auto
<ul>
<li><span>strategy</span>
<li><span>strategy</span>
<li><span>strategy</span>
</ul>

```

Firstly, which of these is the correct one for my use case? And secondly, while conventionally, you would add this to the function.php file, what is the Pinegrow way to implement?

---

<div class="post-metadata">

**Author:** ![Hannah](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/hannah/32/5047_2.png) [@Hannah](https://forum.pinegrow.com/u/Hannah)\
**Post date:** [February 23, 2023, 10:49am UTC](https://forum.pinegrow.com/t/how-to-correctly-implement-custom-php/7767/2 "2023-02-23T10:49:12Z")

</div>

As it turns out, I simply have to not complete the field and it doesn’t show automatically 😆

However, the issue here is the implement of custom php. Using this example, it would be good to see how to input php correctly within Pinegrow.
