Support

Account

Forum Replies Created

  • Also in my-block.php file, is there a way to get
    <script type="module" src="https://unpkg.com/@splinetool/viewer/build/spline-viewer.js"></script> to process in the editor?

    This doesn’t seem to process in the editor; only on the front end:

    <div <?php echo $anchor; ?>class="<?php echo esc_attr( $class_name ); ?>">
    <script type="module" src="https://unpkg.com/@splinetool/viewer/build/spline-viewer.js"></script>
    <spline-viewer url="<?php echo $text; ?>"></spline-viewer>
    </div>
    
  • I found a way that works, but I don’t know if it’s the best practice today. This uses Bill Erickson’s tutorial. https://www.billerickson.net/building-acf-blocks-with-block-json/#script

    So, script in block.json should point to a function rather than file.

    Although, now my function is in the functions.php file instead of with my block. I’m not a PHP expert so maybe there’s a way to keep this more tidy.

  • Permissions are not the issue. I inherited a WP project already using ACF Pro where the fields weren’t saved as JSON. Using Sage theme, ACF typically knows where to find the acf-json directory. In this case, it didn’t. I also tried adding the WP filter to specify the location of the acf-json directory, and while it saves the field groups as json files into the acf-json directory, I still get “Awaiting Save” next to all my field groups.


    @hdevilbiss
    thank you, but that still didn’t work for me. I started from scratch without importing any JSON files, created a new field group, ticked the box to save as JSON, and still got “Awaiting Save” even though the JSON file has been save to the acf-json directory.

    `
    add_filter(‘acf/settings/save_json’, __NAMESPACE__ . ‘\\my_acf_json_save_point’);

    function my_acf_json_save_point( $path ) {
    // update path
    $path = get_stylesheet_directory() . ‘/resources/acf-json’;
    // return
    return $path;
    }
    `

  • I haven’t always found this to be accurate. If you search by place, the first object in the array is going to be the place name. But, if you search by numbered address, the first object is going to be the address number instead.

    Some “places” aren’t going to start with a name if they aren’t registered with Google, for example. Instead, they are going to start with a number address.

  • What about using it inside a foreach loop? This doesn’t work:

    $images = get_field('slides', false); 
    $size = 'full';
    $rand = array_rand($images, 1);
    
    foreach( $images as $image_id ) :
    wp_get_attachment_image( $image_id[$rand], $size, false, array('loading' => 'auto'));
    endforeach;
  • Normally, in my footer, I’d pull ACF fields from the Contact page. That post ID is 11. I decided to use ACF Gutenberg blocks instead. The block file is called business-info.blade.php. Therefore, business-info is my block name. Is it possible to parse that block from my Contact page into the footer?

    I thought this might work:

    `
    if ( function_exists( ‘get_field’ ) ) {
    $pid = get_post( 11 );
    if ( has_blocks( $pid_content ) ) {
    $blocks = parse_blocks( $pid->post_content );
    // my field called name
    $name = $block[‘attrs’][‘data’][‘name’];
    foreach ( $blocks as $block ) {
    if ( $block[‘blockName’] === ‘acf/business-info’ ) {
    echo $name;
    }
    }
    }
    }
    `

  • So, it looks like having tabs in your ACF field group is the culprit! Major bug!

  • I’m having the same freak issue. It just started for no apparent reason. I even tried recreating the field, updating the post, updating the field group. WTF?!

  • I’m having the issue with shortcodes being wrapped inside p and followed by br.

    @bernard-jean
    solution doesn’t seem to work for me. I’m using Custom Content Shortcode, if that matters.

    Using ACF Pro 5.3.7

  • Hey @hube2 Thanks for your reply. I figured it was something unusual. At least that puts a rest to my search.

  • I figured out a solution based on Kalen Johnson’s repo.

    <?php if( have_rows('content') ): ?>
    
    <?php $j=1; while ( have_rows('content') ) : the_row(); ?>
    
    <?php	if( get_row_layout() == 'accordion' ): ?>
    
    <?php	if (get_sub_field('heading')) { ?>
    <h2 class="title text-center"><?php the_sub_field('heading'); ?></h2>
    <?php } ?>
    
    <?php if( have_rows('sections') ): ?>
    
    <div class="panel-group" id="accordion-<?php echo $j; ?>" role="tablist" aria-multiselectable="true">
    
    <?php	$i=1; while ( have_rows('sections') ) : the_row(); ?>
    
    <div class="panel panel-default">
    <div class="panel-heading" role="tab" id="heading-<?php echo $i; ?>">
    <h2 class="panel-title">
    <a data-toggle="collapse" data-parent="#accordion-<?php echo $j; ?>" href="#collapse-<?php echo $j; ?>-<?php echo $i; ?>" aria-expanded="true" aria-controls="collapseOne">
    <?php the_sub_field('question'); ?>
    </a>
    </h2>
    </div>
    
    <div id="collapse-<?php echo $j; ?>-<?php echo $i; ?>" class="panel-collapse collapse <?php if ($i==1) { echo 'in'; } ?>" role="tabpanel" aria-labelledby="heading-<?php echo $i; ?>">
    <div class="panel-body">
    <?php the_sub_field('answer'); ?>
    </div>
    </div>
        
    </div>
    <?php $i++; endwhile; ?>
    </div>
    
    <?php endif; ?>
    <?php endif; ?>
    
    <?php $j++; endwhile; ?>
    
    <?php else : endif; ?>
  • Looking further, here’s my problem:

    Currently, it outputs like this:

    Accordion 1
    -Collapse 1
    -Collapse 2
    -Collapse 3

    Accordion 2
    -Collapse 1
    -Collapse 2
    -Collapse 3

    It needs to output like this:

    Accordion 1
    -Collapse 1
    -Collapse 2
    -Collapse 3

    Accordion 2
    -Collapse 4
    -Collapse 5
    -Collapse 6

    How can this be accomplished?

  • This reply has been marked as private.
  • @elliot My screenshots were from Chrome v 41.x desktop.

    In Firefox 36.x desktop, it’s setting the width to auto, as you intended, but the height is always set to 30px tall. Although, it’s not as bad as Chrome, it still looks pretty bad.

    In Safari 8.x desktop, it looks as you probably intended – perfect!

    IE11 gets it right, too.

  • @elliot First of all, shame on me, I didn’t optimize those svgs as I normally would through grunt or gulp.

    I’ve included the svg code for one of the svg images as seen in my screenshot earlier from this thread.

    
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
    <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    	 viewBox="0 0 584.8 149.9" enable-background="new 0 0 584.8 149.9" xml:space="preserve">
    <g>
    	<path fill="#FFFFFF" d="M158.2,17.5c-1.2,0-2.3-0.1-3.3-0.4c-1-0.2-1.8-0.5-2.3-0.9l0.4-3.5c0.5,0.5,1.2,0.9,2.1,1.3
    		c0.9,0.3,2,0.5,3.1,0.5c2,0,3-0.6,3-1.8c0-0.4-0.1-0.7-0.3-1s-0.4-0.5-0.6-0.7c-0.3-0.2-0.6-0.4-0.9-0.5c-0.3-0.1-0.6-0.3-0.9-0.4
    		l-2.3-0.8l-1-0.4c-1-0.4-1.7-0.9-2.2-1.5c-0.5-0.6-0.7-1.4-0.8-2.4c0-0.6,0.1-1.3,0.4-1.9c0.2-0.6,0.6-1.1,1.1-1.6
    		c0.5-0.5,1.1-0.9,1.9-1.1s1.7-0.4,2.7-0.4c0.5,0,1.1,0,1.6,0.1c0.5,0.1,1,0.2,1.5,0.3c0.5,0.1,0.9,0.3,1.3,0.4
    		c0.4,0.2,0.7,0.3,0.9,0.5l-0.3,3.1c-1.9-1-3.5-1.5-4.9-1.5c-0.4,0-0.8,0-1.2,0.1c-0.4,0.1-0.7,0.2-1,0.3c-0.3,0.1-0.5,0.3-0.7,0.6
    		c-0.2,0.2-0.3,0.5-0.3,0.8c0,0.4,0.1,0.7,0.3,1c0.2,0.2,0.5,0.4,0.9,0.6c0.4,0.2,0.9,0.4,1.5,0.5c0.6,0.2,1.3,0.4,2.1,0.7l1.3,0.5
    		c0.3,0.1,0.7,0.3,1.1,0.6c0.4,0.2,0.7,0.5,1,0.9s0.6,0.8,0.8,1.2c0.2,0.5,0.3,1,0.3,1.6c0,0.5-0.1,1.1-0.2,1.7
    		c-0.1,0.6-0.4,1.1-0.9,1.7c-0.4,0.5-1.1,1-2,1.3C160.8,17.3,159.7,17.5,158.2,17.5z"/>
    </g>
    <!-- a bunch of paths more… -->
    </svg>
    
  • @elliot I’m not sure why my screenshot didn’t attach last time. I’ll try again…

  • This reply has been marked as private.
Viewing 18 posts - 1 through 18 (of 18 total)