rchipka / advanced-custom-blocks Goto Github PK
View Code? Open in Web Editor NEWACF integrations for Gutenberg blocks
ACF integrations for Gutenberg blocks
Hello,
Let me first thank you for creating this great alternative to block generation.
Sometimes we just want a quick way to play with some block ideas, but don't want to waste time with all the details that the code approach brings. This plugin is great for that.
Anyway, you should consider adding an icon control to the plugin.
This would help to create blocks with much more sofisticated layouts, maybe using FontAwesome 5.
After I activate the plugin I get all these errors and I can't get he plugin to work:
Notice: Undefined index: post in \wp-content\plugins\advanced-custom-blocks-master\advanced-custom-blocks.php on line 190
Notice: Undefined index: block_name in \wp-content\plugins\advanced-custom-blocks-master\advanced-custom-blocks.php on line 195
Notice: Undefined index: block_name in \wp-content\plugins\advanced-custom-blocks-master\advanced-custom-blocks.php on line 195
Notice: Undefined index: post_id in \wp-content\plugins\advanced-custom-blocks-master\advanced-custom-blocks.php on line 39
Notice: Undefined index: post in \wp-content\plugins\advanced-custom-blocks-master\advanced-custom-blocks.php on line 40
Notice: Undefined index: post_id in \wp-content\plugins\advanced-custom-blocks-master\advanced-custom-blocks.php on line 40
Notice: Undefined index: attributes in \wp-content\plugins\advanced-custom-blocks-master\advanced-custom-blocks.php on line 40
Notice: Undefined index: block_name in \wp-content\plugins\advanced-custom-blocks-master\advanced-custom-blocks.php on line 195
Notice: Undefined index: post in \wp-content\plugins\advanced-custom-blocks-master\advanced-custom-blocks.php on line 207
I have a feeling that I'm missing something super simple and straightforward but I'm having a bit of trouble so here's the issue.
Downloaded the zipped repos for Advanced Custom Blocks and the master of Gutenberg Block Partials. Installed and activated both of them as plugins using the upload plugin menu.
When I opened a new post it very briefly flashed an error message. I took a picture but unfortunately since taking it it seems my auto file cleaner bot has deleted it.
Anyway it said something to the extent of that it couldn't find a blocks folder in my theme folder. So I created one, and now it doesn't give me an error message. BUT it also still isn't working. I create a field group in ACF just like the pictures posted in the ACF github discussion thread and it results in nada.
I have a feeling I'm missing something here really basic. The main thing is that, if I think about it, it seems I should be putting something in that blocks folder that I had to create right? Was I supposed to install the gutenberg partials in my theme folder? Or maybe was I supposed to use them to write my own php template partial for the block? In the thread you said that it didn't need to write any code but it seems like I would need to, to some extent, to define how the fields would be put onto the page right?
I installed plugin from zip from zip file. I changed wp.hooks to wp.acf_hooks as per the instructions on the README. But I get this error code:
Parse error: syntax error, unexpected end of file in /app/public/wp-content/plugins/wp-acf-gutenberg-master/wp-acf-gutenburg.php on line 284
O checked the file but I don't see what it's referring to. Line 284 is the end of the file and is blank.
Could maybe be a jQuery compatibility issue?
I have a custom block just containing a title (Text) field and a content (WYSIWYG) field. The WYSIWYG has 2 tabs, visual and text. on clicking visual I get the following in the console and it fails to switch.
Uncaught TypeError: Cannot read property 'onpageload' of undefined
at wp-tinymce.php?c=1&ver=4800-20180716:3
at e (wp-tinymce.php?c=1&ver=4800-20180716:3)
at je.b.bind (wp-tinymce.php?c=1&ver=4800-20180716:3)
at Object.F [as bind] (wp-tinymce.php?c=1&ver=4800-20180716:3)
at Object.init (wp-tinymce.php?c=1&ver=4800-20180716:3)
at e (editor.min.js?ver=4.9.8:1)
at HTMLDocument. (editor.min.js?ver=4.9.8:1)
at C (wp-tinymce.php?c=1&ver=4800-20180716:3)
at HTMLDocument.d (wp-tinymce.php?c=1&ver=4800-20180716:3)
This might be too much to ask, but it was working in v2.0.2 (before block templates were moved out of functions.php and put in the blocks/acf folder).
None of the tab blocks I've seen allow blocks as content, so I made a tabs block that's just a relationship field to select posts or pages for the tab content - basically allows for complex tab content without cluttering the page containing the tabs.
The problem is that blocks created with this plugin are not displayed when pulled into the tab (core and atomic blocks work fine). The markup from blocks/acf is there, but none of the data from the custom fields is pulled in. This is true of both my post grid block and icons block (one uses a loop, the other doesn't).
Tab block template:
$tabs = get_field('tab_content');
if( $tabs ): ?>
<div class="tabs">
<ul>
<?php foreach( $tabs as $tab ): ?>
<li><?php echo '<a href="#' . $tab->post_name . '">' . get_the_title( $tab->ID ) . '</a>'; </li>
<?php endforeach; ?>
</ul>
<?php foreach( $tabs as $tab ): ?>
<div id="<?php echo $tab->post_name; ?>">
<?php $tabcontent = apply_filters('the_content', $tab->post_content);
echo $tabcontent; ?>
</div>
<?php endforeach; ?>
</div><!-- /tabs -->
<?php endif;
Icons block template (repeater field):
if( have_rows('ma_icons') ):
$ma_iconcount = count(get_field('ma_icons'));
echo '<div class="wp-block-columns alignwide has-' . $ma_iconcount . '-columns">';
while( have_rows('ma_icons') ): the_row();
$link = get_sub_field('icon_link');
$icon = get_sub_field('icon');
$icon_hover = get_sub_field('icon_hover');
echo '<div class="wp-block-column">'; ?>
<a class="icon center" href="<?php
if( $link ) { echo $link['url']; } else { echo ' '; } ?>" target="<?php echo $link['target']; ?>">
<span class="icon-img"><img src="<? echo $icon; ?>" alt="" /><img src="<? echo $icon_hover; ?>" alt="" /></span>
<?php echo $link['title']; ?>
</a>
<?php echo '</div>'; endwhile; echo '</div>';
endif;
Post grid block template:
if (get_field('num_posts')) { $num_posts = get_field('num_posts'); }
else {$num_posts = 4;}
$posts_cat_array = get_field('posts_cat');
$catstring = '';
if ($posts_cat_array) {
foreach ($posts_cat_array as $value) :
$catstring .= $value->term_id . ", ";
endforeach;
}
$showimg = get_field('show_featured_image');
$showdate = get_field('show_date');
$contentdisp = get_field('content_display');
$linktxt = get_field('link_text');
$linktype = get_field('link_type');
?>
<div class="ab-block-post-grid alignwide"><div class="ab-post-grid-items is-grid columns-2">
<?php $postsloop = new WP_Query( array( 'post_type' => 'post', 'category__and' => array( $catstring ), 'posts_per_page' => $num_posts ) );
if ( $postsloop->have_posts() ) { while ( $postsloop->have_posts() ) : $postsloop->the_post();
echo '<article';
if ( has_post_thumbnail() ) { echo ' class="has-thumb"'; }
echo '>';
if ( $showimg && has_post_thumbnail() ) { ?>
<div class="ab-block-post-grid-image">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
</a>
</div>
<?php } ?>
<div class="ab-block-post-grid-text">
<h2 class="ab-block-post-grid-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php if ($showdate) { atomic_blocks_post_byline(); }
if ($contentdisp == 'excerpt') { ?>
<div class="ab-block-post-grid-excerpt"><?php the_excerpt(); ?></div>
<?php } else { ?>
<div class="ab-block-post-grid-content"><?php the_content(); ?></div>
<?php } if ($linktxt) { echo '<p class="right">';
if ($linktype == 'text') { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php echo $linktxt; ?></a>
<?php } else { ?>
<a href="<?php the_permalink(); ?>" class="ab-button ab-button-shape-circular ab-button-size-small" style="color:#ffffff;background-color:#c44d3b"><?php echo $linktxt; ?></a>
<?php } echo '</p>'; } ?>
</div>
<?php echo '</article>';
endwhile; } wp_reset_query();
echo '</div></div>';
When giving multiple custom blocks the same category, it creates a new instance of the category in the block selector. However, each instance contains all blocks assigned.
@ATomilov @thedonquixotic If either of you have time to contribute, this would be greatly appreciated.
This should be straightforward since you've both implemented working solutions.
Pull needed info from the original ACF post.
In the mean time I'll work on closing out #3
So I found out if I remove the following check it shows on the front end template.
//if (acf_get_field_group_visibility($group)) {
$groups[] = $group;
//}
Why would this not be working as standard with the check in place?
When trying to activate the plugin after being uploaded I get this error:
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\dgewp\wp-content\plugins\advanced-custom-blocks-master\advanced-custom-blocks.php on line 372
It can be solved by changing <?
on line 370 to <?php
I changed lines 294-295 of advanced-custom-blocks.php:
if (file_exists(get_stylesheet_directory() . $path)) {
include(get_stylesheet_directory() . $path);
Hi! I am new in wordpress, and I was abble to load the block in the admin post, but I have problem to load in the frontend, and created a folder inside the theme "blocks/acf/testimonial.php", where do I put "Rendering block content", I am placing it inside the functions.php
Gotta publish this eventually.
Should probably clarify differences in philosophy and implementation for this project vs the soon-to-be ACF core version.
Also accepting name suggestions below.
The reason I chose a filter is for more flexibility when overriding, replacing, or wrapping specific block types.
I think an action API would probably be easier though, so..
We should rename the filter API to use the name acf/block_content
instead
We should add action for acf/render_block
, which will catch the output using output buffering.
This captured output should then be run through the acf/block_content
filters.
This way, implementations that aren't concerned with replacing content don't have to worry about implementing using a filter and therefore also using ob_start()
, etc. each time.
So I created a block, it has a couple of text inputs and some post object fields. If I have one of these on a page... fine. As soon as I add a second it seems to be pre-populated with the data from the previous block and gets confused when I try and edit it. Basically unusable.
If I create new group with gallery type field and put the block with this group the block don't save input images.
Hey. If I create several blocks of the same type on the page, for example, testimonials, then the information entered in the last created block overwrites what was contained in the previous blocks of that type. I think it's a cache, but I can not figure out how to fix it. P.S. It's not a cache, just render elements with same id, name and etc. P.S.S Although, if the matter were in the same names, ids and etc, then changing data in any block of the same type overwrote old data in others, but it is not. P.S.S.S I think that happened because the same type blocks on one page have the same post_id. Look at the pictures:
Have you any ideas how fix it?) Sorry to trouble you)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.