Support Forum
MB views shortcode doesn't render in any page out of the CPT page/post template!
Ex: If I add the shortcode to the front page, it's displayed an empty value or any place out of the CPT template page.
I'm using Bricks Builder loop, I want to display it in the loop of Bricks / Repeater in oxygen as ul/li HTML.
Now the loop display is as <br> in HTML.
Regards
P.S. I don't want to use "WYSIWYG" for this.
"
SS 👇
Hi,
In case of using Oxygen/Bricks Builder, please reach out to them if you have any issues with installation, configuration, compatibility, or usage.
Refer to our support policy https://metabox.io/support/topic/support-policy/
In case of using coding, you can add the HTML tags <ul> <li>
and image icons when outputting the field value. Refer to the documentation https://docs.metabox.io/fields/text/#template-usage
let's pretend there's no Oxygen or Bricks,
Please help me with the following,
Question one:
1. I added the MB views shortcode on some pages!
It doesn't work, Except on the page for CPT template,
How I can render the MB views shortcode on any page/post?
Question 2:
2. How I can execute the PHP code on any page?
Ex: I want to show/ execute the code on the front page.
How to do it?
where to put the code?
Using a child theme? Gutenberg?
Question 3:
The following code, What I need to change in case I have this custom field:
Field > Group A, ID: group_service
Inside the Group, Text Field > ID: text_list_ms44n1h3uw
The text field is also "Cloneable - Sortable"
Add to above I want the tags "HTML tags <ul> <li> a"
ul for group, li for each cloneable the text field???
What to change or edit in this code, and where to execute it?
<?php $values = rwmb_meta( 'my_field_id' ) ?>
<?php foreach ( $values as $value ) : ?>
<p><?= $value ?></p>
<?php endforeach ?>
Regards
Hi,
I think you should have a basic knowledge of PHP and WordPress coding to understand what is the custom field and how to output the field value on your site.
https://wordpress.org/support/article/custom-fields/
https://docs.metabox.io/custom-fields/
1. Custom fields are associated with the post/page, so if the page does not have the custom field, the code will not output the field value.
2. You can create a custom code in View, then set the View type to Shortcode and add this shortcode to the post content to output the field value.
If you want to use the PHP code, please create your own shortcode by following this documentation https://codex.wordpress.org/Shortcode_API
3. It is the basic PHP code, you can add the <ul>
tag before/after the loop and add the <li>
tag inside the loop.
<?php $values = rwmb_meta( 'text_list_ms44n1h3uw' ) ?>
<ul>
<?php foreach ( $values as $value ) : ?>
<li><?= $value ?></li>
<?php endforeach ?>
</ul>
Thanks Long! I'll start with these links you sent.