AdvancedCustomFields / AdvancedCustomFields/acf

Trouble Getting Multiple Blocks To Show

Open
#226 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

I am trying to get 3 simple blocks to show... But they won't show. I don't understand what I'm doing wrong, maybe I can find some help here.

Here's How I'm Registering the blocks:

`// ACF Blocks
function _themename_reg_acf_blocks() {

// Block Arrays.
$abl_contact_block = array(
'name' => 'abl-contact-section',
'title' => __('Contact Section'),
'description' => __('A custom contact block.'),
'render_template' => 'template-parts/acf_blocks/pages/contact_section.php',
'mode' => 'edit',
'category' => '_themename-blocks',
'icon' => 'email-alt2',
'keywords' => array( 'contact', 'information' ),
);

$abl_ig_block = array(
'name' => 'abl-ig-section',
'title' => __('Instagram Feed Section'),
'description' => __('A custom Instagram block.'),
'render_template' => 'template-parts/acf_blocks/pages/instagram_block.php',
'mode' => 'edit',
'post_types' => 'page',
'category' => '_themename-blocks',
'icon' => 'camera',
'keywords' => array( 'instagram', 'insta', 'instagram feed' ),
);

$abl_slider_block = array(
'name' => 'abl-slider-section',
'title' => __('Slider Section'),
'description' => __('A custom slider block.'),
'render_template' => 'template-parts/acf_blocks/pages/slider_block.php',
'mode' => 'edit',
'post_types' => 'page',
'category' => '_themename-blocks',
'icon' => 'format-gallery',
'keywords' => array( 'slider', 'carousel'),
);

$blocks = [
$abl_contact_block,
$abl_ig_block,
$abl_slider_block
];

foreach($blocks as $block) {
acf_register_block($block);
}
}

// Check if function exists and hook into setup.
if( function_exists('acf_register_block_type') ) {
add_action('acf/init', '_themename_reg_acf_blocks');
}`

The Contact Section Block:
Screen Shot 2019-09-25 at 11 40 51 AM

This works fine... no problem here.

The Instagram Section Block:
Screen Shot 2019-09-25 at 11 41 02 AM

This was working fine til I tried to add a link... now it's not showing at all. When I did add the link it would not render the link in anyway. I've since removed it... It still doesn't show.

The Slider Section:
Screen Shot 2019-09-25 at 11 41 10 AM

This just isn't showing at all... I'm using the image array.

What might I be doing wrong here..

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with _themename_reg_acf_blocks and compare the three block arrays, their acf_register_block calls, and the referenced template-parts/acf_blocks/pages/*.php files. Check how the Contact Section differs from the Instagram and Slider sections; done means all three registered blocks appear and render their configured content.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.