Answer the question
In order to leave comments, you need to log in
How to add html templates with modified text via WordPress admin panel?
There is a layout of one page, in this layout there is a slider with reviews from users and users, accordingly, can leave new reviews. This happens in such a way that the user writes a review in the form where he fills in two fields: full name, Review. After submitting the form, the data from the fields is sent to the mail, they look at this review and decide whether to add it to this slider or not. And with adding it to the slider, problems arise. Of course, you can copy the text of the review from the letter and write another slider block directly in the .php file, but with the corresponding text, but I think there is another way out. I am not strong in WordPress itself, but I am almost sure that there is such a method to write a review text in the admin panel and it will insert this text into the corresponding html template and add it to the right place on the page.
Those. in my meager view it looks like this:
I am writing an html template, in my view it looks something like this:
<div class="review">
<div class="reivew-title>
<div class="review-title-photo"></div>
<div class="review-title-name"><?php esc_html($review_name); ?></div>
</div>
<div class="review-content">
<div class="review-content-text">
<?php esc_html($review_content_text); ?>
</div>
</div>
</div>
$review_name
and $review_content_text
they are substituted for the desired one in the written template, and this template is inserted in the right place on the page. Answer the question
In order to leave comments, you need to log in
You need to use a plugin, for example advanced custom fields, or carbon fields, they will allow you to fill in data in the admin part, and in the template you will use something like
foreach($reviews as $rev)
{
<div class="review">
<div class="reivew-title>
<div class="review-title-photo"></div>
<div class="review-title-name"><?= $rev["title"] ?></div>
</div>
<div class="review-content">
<div class="review-content-text">
<?= $rev["text"] ?>
</div>
</div>
</div>
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question