Community Forums › Forums › Genesis Custom Blocks › Programmatically creating a repeater block.
Tagged: development, Genesis Custom Blocks
- This topic has 9 replies, 9 voices, and was last updated 11 months ago by bishopdz.
-
AuthorPosts
-
April 29, 2022 at 8:36 am #505157bishopdzParticipant
Hello, my development team is using Genesis Custom Blocks to programmatically create blocks that are stored and reused in our git repo. I am trying to code a repeater block but I am stuck because I have not been able to find any examples of this. Here is what I have tried that seems syntactically correct.
1:
<?phpuse function Genesis\CustomBlocks\add_block;
function add_fees_block() {
// One long array with lots defined.
add_block(
'fees',
array(
'title' => 'Fees Block',
'category' => 'common',
'icon' => 'account_circle',
'fields' => array(
'repeater' => array(
'name' => 'repeater',
'label' => 'Repeater',
'control' => 'repeater',
'type' => 'text',
),
),
),
);
}
add_action( 'genesis_custom_blocks_add_blocks', 'add_fees_block');2:
<?phpuse function Genesis\CustomBlocks\add_block;
function add_fees_block() {
// One long array with lots defined.
add_block(
'fees',
array(
'title' => 'Fees Block',
'category' => 'common',
'icon' => 'account_circle',
'fields' => array(
'repeater' => array(
'name' => 'repeater',
'label' => 'Repeater',
'control' => 'repeater',
'field' => 'text',
),
),
),
);
}
add_action( 'genesis_custom_blocks_add_blocks', 'add_fees_block');3:
<?phpuse function Genesis\CustomBlocks\add_block;
function add_fees_block() {
// One long array with lots defined.
add_block(
'fees',
array(
'title' => 'Fees Block',
'category' => 'common',
'icon' => 'account_circle',
'fields' => array(
'repeat' => array(
'name' => 'repeat',
'label' => 'Repeater',
'control' => 'repeater',
'fields' => array('text' => array(
'name' => 'text',
'label' => 'Text',
'control' => 'text',
),
),
),
),
),
);
}
add_action( 'genesis_custom_blocks_add_blocks', 'add_fees_block');I am unsure if it is even possible but it would help us a lot.
Thank you for your time.June 11, 2022 at 11:42 am #505397samneerhaParticipantTechBigis
The Hub of Premium Apps and Games
With our website TechBigis, you can effortlessly search and download millions of apps and games for free, whether they are free or premium versions. Aside from that, you can find helpful information and Modified Apps or Games on Android, iOS, Windows, and many other things every day.June 22, 2022 at 3:03 am #505456shahzain1ParticipantGetinshotproapk
Get the Latest Updates and News about InShot.
With Our Website Getinshotproapk, You can search and download the best video and photo editing app here with the latest news and update version. This app is totally free and available in different variants like Android, IOS, PC, and Windows so chose as per your requirement and download the inshot app.August 7, 2022 at 11:25 am #505647MB03043666ParticipantThe game has everything you could ever want, from unlimited money to chatting with other players online and much more. You can now play this game in multiplayer mode if you want, or offline if you prefer Then Check out this game Ludo Talent Mod Apk
August 23, 2022 at 11:30 am #505722MichaelmatiParticipantML Injectors Mobile Legend Updates and News. TheNoobGamerz offers the latest news and updated versions of the best video games like MLBB. Download the latest ml skin injector as per your requirement and choose between Android, IOS, Windows, and PC.
October 10, 2022 at 3:53 am #505965rebecca7bParticipantLet’s first create our field. This field can be used however you want, but I will assume that we are working on a meta box so I am getting the field data with the function get_post_meta.
<?php
// Assuming we are setting a field inside a metabox
$field_data = get_post_meta( $post_id, 'field_data', true );?>
<label for="field_data">
<?php _e( 'Field Name', 'yourtextdomain' ); ?>
</label>
<div id="field_data">
<?php foreach( $field_data as $field ) { ?>
<div class="field-group">
<input type="text" name="field_data[] value="<?php echo $field; ?>" />
<button type="button" class="button button-secondary field-data-remove">X</button>
</div>
<?php } ?>
</div>
<button type="button" id="field_data_add" class="button button-primary">Add</button>January 17, 2023 at 4:00 am #506592samneerhaParticipantWe are a registered trademark established in 2015; in these years, we have had more than 51000+ happy customers worldwide. Our site is the only official and authorized to sell BlackPods 3
March 8, 2023 at 1:29 pm #506921quranrumiParticipantThe purpose of the Quran Rumi is to provide
knowledge of the holy Quran. Learn the teachings of
Allah almighty and act upon them. I love learning about
the Quran and its teachings. The Quran provides knowledge
of God and His ways. I hope that by reading this write up
the Quran in roman, you will be able to learn more about
the Quran and how it can help you live a better lifeSeptember 25, 2023 at 2:13 pm #507667Jelly4567BlockedCreating a repeater block programmatically typically involves working within the context of a content management system (CMS) or web development framework. Repeater blocks are a way to dynamically generate and display repeated sets of content or data, such as lists of items or rows in a database. The implementation details can vary based on the CMS or framework you are using. I'll provide a general outline Qureka Banner of how you might programmatically create a repeater block in a web development context:
Choose a Development Environment:
Select a development environment or framework that supports the creation of repeater blocks. Common choices include WordPress, Drupal, Joomla, or a custom web application built with a framework like Django, Ruby on Rails, or Express.js.
October 13, 2023 at 4:03 am #507688MaarklariusParticipantI encountered a similar problem, I hope you have an answer
-
AuthorPosts
- You must be logged in to reply to this topic.