Get value fields in php variable
-
I write in template. I want to get value fields current post in php varieble.
Can i get it?
-
What code are you trying? It would really help in your questions to us (of which you’ve sent several over the last few days), if you would provide an example of what you’re trying.
get_post_meta
, WordPress function, is the primary way of getting field value with PHP:
https://developer.www.ads-software.com/reference/functions/get_post_meta/<div class=”container breadcramp-store”>
<div class=”row”>
<div class=”col-lg-12″>- Главная >
- Магазин подарков >
- {@post_title}
</div>
</div>
</div><div class=”container cover-content-card”>
<div class=”row”>
<div class=”col-lg-6 prevyu-card”>
</div>
<div class=”col-lg-6 desc-card”>
<div class=”row”>
<div class=”col-lg-12″>
<h1 class=”title-card”>{@tovarname}</h1>
<p class=”amount”>Вес: {@mass}</p>
<p class=”price-card”>{@opt}</p>
<p class=”price-card”>Стоимость: {@price}</p><select class=”select_phone”>
<option>+380 (44) 333-42-45</option>
<option>+380 (96) 769-57-52</option>
<option>+380 (95) 148-66-96</option>
<option>+380 (73) 935-05-05</option>
<option>+380 (44) 333-42-45</option>
<option>+380 (97) 935-05-05</option>
</select>
</div>
<div class=”col-lg-12″>
<button class=”buttom_style popmake-91″>Заказать товар</button>
</div></div>
<div class=”row delivery-block”>
<div class=”col-lg-4 delivery-icon popmake-107″>
<p class=”desc-delivery popmake-107″>Условия оплаты и доставки</p>
</div>
<div class=”col-lg-4 delivery-icon”>
<p class=”desc-delivery popmake-116″>Время работы</p>
</div>
<div class=”col-lg-4 delivery-icon”>
<p class=”desc-delivery”>Адрес и контакты</p>
</div>
</div></div>
</div>
</div>
<div class=”container”>
<div class=”row desc-tovar-block”>
<div class=”col-lg-3 tab_card action_tab tab_description” id=”js-tovar-desc”>Описание</div>
<div class=”col-lg-3 tab_card tab_characters” id=”js-tovar-characters”>Характеристики</div>
<div class=”col-lg-3 tab_card tab_information” id=”js-tovar-information”>Как заказать</div>
<div class=”col-lg-3 tab_card tab_review” id=”js-tovar-review”>Отзывы о товаре</div>
</div>
</div>
<div class=”container text_container”>
<div class=”row”>
<div class=”col-lg-12 js_info_block block_description”>
{@description}
</div>
<div class=”col-lg-12 js_info_block block_characters”>
{@charakters}
</div>
<div class=”col-lg-12 js_info_block block_information”>
{@information}
</div>
<div class=”col-lg-12 js_info_block block_reviews”>
{@review}
</div>
</div>
</div>This is cod in template. After I want use loop
[pods where=”category.meta_value=’this_category'” ]
<p>Price: {@price}</p>
[/pods]Can i get category tovar, and automatically use condition in loop, or use if else for choise category.
I’m sorry but I think we’re having some language issues. What’s your native language and I’ll see if I can get someone who can help with the translation.
The template you provided above is mostly ‘static’ content. Very little of it is actually Pods or Loop based. I’d focus your Pods Template specifically on content that will be output through the ‘loop’. Your shortcode can drive the loop and the template will be called for each post through that loop.
If you’re trying to automate some kind of Category/Condition setup, you need to be using PHP for that as that’s beyond the capabilities of the Pods Template, especially automatic changes in category, etc. As we indicated several weeks back, if you’re trying to do a Product Catalog or eCommerce site, that’s better handled with WooCommerce. Pods Templates and Shortcodes cannot possibly replace what PHP can do and if you’re trying to do something as complicated as you’re trying to do, you’ll need to learn PHP.
For that shortcode ‘category’ if it’s a taxonomy, can’t use
category.meta_value
, it would have to use category.name.I honestly feel that as much as you are asking on our forums, you’d be better off joining our Slack Chat at https://pods.io/chat/
Thanks, i joined) I speak Russian
Good I’ve seen you drop into our Slack Chat. Closing this ticket as resolved as it seems like from the post you made there that you’ve actually solved this one.
- The topic ‘Get value fields in php variable’ is closed to new replies.