I'm working in an environment in VS Code and running my work on a sever withnpm run watch
command. I am referencing the files themselves in my functions.php file, I can choose the module in the wordpress admin panel, but I cannot actually get my 'testimonials_1' field to pop up on the preview page. That's the only piece I'm trying to get right now.
My functions file
<?php
function module_testimonials_acf() {
return array(
'key' => 'testimonials_module',
'name' => 'testimonials_module',
'label' => 'Testimonials',
'display' => 'block',
'sub_fields' => array(
array(
'key' => 'testimonials_repeater_1',
'name' => 'testimonials_repeater_1',
'label' => 'First Testimonial',
'type' => 'repeater',
'min' => 1,
'max' => 1,
'layout' => 'block',
'return_format' => 'array',
'required' => 0,
'sub_fields' => array(
array(
'key' => 'testimonials_paragraph_1',
'name' => 'testimonial_1',
'label' => 'Testimonial 1',
'type' => 'textarea',
'instructions' => 'The testimonial goes here.',
'required' => 1,
'wrapper' => array(
'width' => '40'
)
),
array(
'key' => 'testimonials_product_description_1',
'name' => 'testimonials_product_description_1',
'label' => 'Product Description 1',
'type' => 'textarea',
'instructions' => 'The product description goes here. (Product info, color, location)',
'required' => 1,
'wrapper' => array(
'width' => '40'
)
),
array(
'key' => 'testimonial_image_1',
'name' => 'testimonial_image_1',
'label' => 'Testimonial Image 1',
'type' => 'image',
'instructions' => 'Testimonial Background Image',
'required' => 1,
'return_format' => 'url',
'preview_size' => 'medium',
'min_width' => '100',
'wrapper' => array(
'width' => '20'
)
)
)
),
array(
'key' => 'testimonials_2',
'name' => 'testimonials_2',
'label' => 'Testimonials 2',
'type' => 'repeater',
'min' => 1,
'max' => 1,
'layout' => 'block',
'return_format' => 'array',
'required' => 0,
'sub_fields' => array(
array(
'key' => 'testimonials_paragraph_2',
'name' => 'testimonials_paragraph_2',
'label' => 'Testimonial 2',
'type' => 'textarea',
'instructions' => 'The testimonial goes here.',
'required' => 1,
'wrapper' => array(
'width' => '40'
)
),
array(
'key' => 'testimonials_product_description_2',
'name' => 'testimonials_product_description_2',
'label' => 'Product Description 2',
'type' => 'textarea',
'instructions' => 'The product description goes here. (Product info, color, location)',
'required' => 1,
'wrapper' => array(
'width' => '40'
)
),
array(
'key' => 'testimonial_image_2',
'name' => 'testimonial_image_2',
'label' => 'Testimonial Image 2',
'type' => 'image',
'instructions' => 'Testimonial Background Image',
'required' => 1,
'return_format' => 'array',
'preview_size' => 'medium',
'min_width' => '1800',
'wrapper' => array(
'width' => '20'
)
)
)
),
array(
'key' => 'testimonials_3',
'name' => 'testimonials_3',
'label' => 'Testimonials 3',
'type' => 'repeater',
'min' => 1,
'max' => 1,
'layout' => 'block',
'return_format' => 'array',
'required' => 0,
'sub_fields' => array(
array(
'key' => 'testimonials_paragraph_3',
'name' => 'testimonials_paragraph_3',
'label' => 'Testimonial 3',
'type' => 'textarea',
'instructions' => 'The testimonial goes here.',
'required' => 1,
'wrapper' => array(
'width' => '40'
)
),
array(
'key' => 'testimonials_product_description_3',
'name' => 'testimonials_product_description_3',
'label' => 'Product Description 3',
'type' => 'textarea',
'instructions' => 'The product description goes here. (Product info, color, location)',
'required' => 1,
'wrapper' => array(
'width' => '40'
)
),
array(
'key' => 'testimonial_image_3',
'name' => 'testimonial_image_3',
'label' => 'Testimonial Image 3',
'type' => 'image',
'instructions' => 'Testimonial Background Image',
'required' => 1,
'return_format' => 'array',
'preview_size' => 'medium',
'min_width' => '1800',
'wrapper' => array(
'width' => '20'
)
)
)
)
)
);
}
?>
My php file with the html in it
<div class="highlight-testimonials">
<div class="parallax" id="behind-content"></div>
<div class="testimonials">
<div class="wrap">
<div class="testing">
<div class="test-intro">
<h3>Testimonials</h3>
<p>See what our customers have to say about their Metal roofs.</p>
<a class="primary-cta" href="#">Start your own project<div class="material-icons">east</div></a>
</div>
<?php
$testimonial_1 = mod_get_field('testimonial_1');
?>
<div class="three-examples">
<div class="col individual-card">
<div class="display-img">
<img src="#" alt=" metals testimonial photo"/>
</div> <!-- .display-img -->
<div class="text-area">
<img class="quo" src="/images/quotes.svg"/>
<p class="p1"><?php echo $testimonial_1 ?></p>
<p>Product information goes here, product, color and location</p>
</div> <!-- .text-area -->
</div> <!-- .col -->
</div> <!-- .three-examples .row -->
</div> <!-- .testing -->
</div> <!-- .wrap-->
</div> <!-- .testimonials -->
</div> <!-- .highlight-testimonials -->
<tr>
<td>
</td>
</tr>
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
HTML (English "hyper text markup language" - hypertext markup language) is a special markup language that is used to create sites on the Internet.
Browsers understand html perfectly and can interpret it in an understandable way. In general, any page on the site is html-code, which the browser translates into a user-friendly form. By the way, the code of any page is available to everyone.
https://www.w3.org/html/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.