Support

Account

Forum Replies Created

  • @antishow

    While this might work, haven’t tested it yet. Either way it isn’t a solution but a work-around. I would imagine most people using ACF blocks are doing so because they don’t want to or have the experience to setup and start using JS within WP.

    Thanks for sharing your solution, I will give this a try.

  • +1 Yes, this feature needs built in!

  • What is the update on this???

    Is there a roadmap or somewhere I can view what is planned for ACF? Mainly with ACF blocks.

    I’m wondering at this point if this feature isn’t coming, if that’s the case I will be forced to look for other options.

  • This is what I’m using to disable core blocks, and WooCommerce blocks. The core blocks I want to use are at the bottom.

    
    function remove_default_blocks($allowed_blocks){
        // Get widget blocks and registered by plugins blocks
        $registered_blocks = WP_Block_Type_Registry::get_instance()->get_all_registered();
    
        // Disable Widgets Blocks
        unset($registered_blocks['core/calendar']);
        unset($registered_blocks['core/legacy-widget']);
        unset($registered_blocks['core/rss']);
        unset($registered_blocks['core/search']);
        unset($registered_blocks['core/tag-cloud']);
        unset($registered_blocks['core/latest-comments']);
        unset($registered_blocks['core/archives']);
        unset($registered_blocks['core/categories']);
        unset($registered_blocks['core/latest-posts']);
        unset($registered_blocks['core/shortcode']);
    
        // Disable WooCommerce Blocks
        unset($registered_blocks['woocommerce/handpicked-products']);
        unset($registered_blocks['woocommerce/product-best-sellers']);
        unset($registered_blocks['woocommerce/product-category']);
        unset($registered_blocks['woocommerce/product-new']);
        unset($registered_blocks['woocommerce/product-on-sale']);
        unset($registered_blocks['woocommerce/product-top-rated']);
        unset($registered_blocks['woocommerce/products-by-attribute']);
        unset($registered_blocks['woocommerce/featured-product']);
    
        // Now $registered_blocks contains only blocks registered by plugins, but we need keys only
        $registered_blocks = array_keys($registered_blocks);
    
        // Merge allowed core blocks with plugins blocks
        return array_merge(array(
            'core/image',
            'core/paragraph',
            'core/heading',
            'core/list'
        ), $registered_blocks);
    }
    
    add_filter('allowed_block_types', 'remove_default_blocks');
    
  • Yes! I was trying to think of a work around, I guess you could manually move the fields with JS but that is pretty hacky.

  • “because TinyMCE displays the button to generate the shortcodes” My editor doesn’t have this, how did you get that button?

  • That’s unfortunate that inner blocks isn’t supported yet. Like you, I had to settle for WYSIWYG editors inside my columns.

    For my column layout I went with a repeater and styled it for a horizontal layout. I widened the content area so there is more room to work inside each column. I also added a button group for different column layouts. For example there are 4 layouts for 3 columns, 5 for a 4 column layout, etc. Then I used JS to resize the column widths based on which layout was selected.

    Overall it works nicely.

  • That’s unfortunate inner-blocks isn’t supported yet. Like you, in the meantime I had to settle for using WYSIWYG editors inside of my columns.

    For my column layout, I went with a repeater and styled them to be horizontal. I widened the content area so there is more room to work inside each column, it works out pretty good. I also added a button group for different column layouts and then use JS to automatically resize the column widths based on the layout selected.

    Overall I guess I am happy with it.

    column layout

  • +11111111111111111111 other people waiting for this

  • All right, I think I got it 🙂 I had to change the taxonomy field to return an object, I didnt catch that in the docs.

    One last question.

    Is there another way of getting the url of the child page in the loop besides using echo $the_post->guid;? That is returning the non permalink like this -> ?post_type=nldf&p=199.

    Thanks for all the help! I’ve learned a lot!

  • Thanks for the response! I am trying the second method, I think it might be close.

    I changed the “nldf_category_type” field to be a taxonomy field and created a custom taxonomy, here is the code for that.

    register_taxonomy(
            'nldf_category',
            'nldf',
            array(
                'label' => 'Category',
                'hierarchical' => false,
                'rewrite' => array( 'slug' => 'group', 'with_front' => true, 'hierarchical' => false),
                'show_in_menu' => false,
                'show_ui' => false
            )
        );

    While troubleshooting here are some things I noticed, for some reason in both loops nothing is getting echo’d out, put if I put in echo “test” it works each time through the loop. Also if var_dump($grouped_posts); I see no mention of any category. And if I echo $category I just get 33223, I am guessing those are IDs of the 2 categories?

    Hmmm, I also just noticed that echo $category->name; gives me nothing.

    I will keep tinkering and see what I can do, probably nothing 🙂

  • Here is the CPT code, just in case.

    function nldf_gallery() {
        $labels = array(
            'name'               => 'NLDF',
            'singular_name'      => 'NLDF',
            'add_new'            => 'Add New',
            'add_new_item'       => 'Add New NLDF',
            'edit_item'          => 'Edit NLDF',
            'new_item'           => 'New NLDF',
            'all_items'          => 'All NLDF',
            'view_item'          => 'View NLDF',
            'search_items'       => 'Search NLDF',
            'not_found'          => 'No NLDF found',
            'not_found_in_trash' => 'No NLDF found in Trash',
            'menu_name'          => 'NLDF'
        );
    
        $args = array(
            'labels'             => $labels,
            'public'             => true,
            'hierarchical'       => true,
            'has_archive'        => false,
            'menu_position'      => 4,
            'menu_icon'          => 'dashicons-format-gallery',
            'supports'           => array('title','editor','comments','revisions','page-attributes')
        );
    
        register_post_type('nldf', $args);
    }
    add_action('init', 'nldf_gallery');
  • Hey John, I am trying to test out your code above, however I am running into a couple roadblocks (which I am not smart enough to figure out 🙂 )

    First, I changed acf/update_value/name=filters, which is my repeater field name.

    Then I added my sub field key, which if I am right is the data-key=”field_5702af55a084f” that is on each td that contains an input/entry on the options page.

    If I run the code now I get the following errors when I click the “Save Options” button…

    
    Warning: Missing argument 2 for my_remove_terms() in /home/evolve/public_html/neilLesson/wp-content/themes/neillesson.com/functions.php on line 403
    
    Warning: Missing argument 3 for my_remove_terms() in /home/evolve/public_html/neilLesson/wp-content/themes/neillesson.com/functions.php on line 403
    
    Fatal error: Call to undefined function get_options() in /home/evolve/public_html/neilLesson/wp-content/themes/neillesson.com/functions.php on line 408
    

    Due to the Fatal Error I tried changing get_options to get_option but then I get…

    
    
    Warning: Missing argument 2 for my_remove_terms() in /home/evolve/public_html/neilLesson/wp-content/themes/neillesson.com/functions.php on line 403
    
    Warning: Missing argument 3 for my_remove_terms() in /home/evolve/public_html/neilLesson/wp-content/themes/neillesson.com/functions.php on line 403
    
    Warning: Invalid argument supplied for foreach() in /home/evolve/public_html/neilLesson/wp-content/themes/neillesson.com/functions.php on line 418
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/evolve/public_html/neilLesson/wp-content/themes/neillesson.com/functions.php:403) in /home/evolve/public_html/neilLesson/wp-includes/pluggable.php on line 1228
    

    I will keep looking into it but any help would be awesome!

  • Thanks for the reply! Your first paragraph is absolutely correct and I found this out a couple hours after posting this and trying a few different things!

    Thanks for the code, I will give it a shot 🙂

  • Crap, I didn’t mean to mark your last comment as the solution, lol, o-well you have been helpful! Thanks for all the feedback. I think your right, I haven’t been able to find an example of this either. Doesn’t Woo-Commerce do this in a sense? I will keep digging/thinking about it.

  • Thanks for the reply. I thought about using the custom fields, I would prefer this method, similar to https://www.advancedcustomfields.com/resources/creating-wp-archive-custom-field-filter/ tutorial but I need the client to be able to add/edit filters on the go. I’m not sure how I would do that with this approach. I don’t want the client messing around in ACF.

    I appreciate the suggestion of the plugins, the one you linked looks nice. I have a big amount of time set aside for coming up with a custom solution, so I’d like to stick with that, at least for now.

  • or maybe…

    – Add an options page under the CPT with filters
    – Add custom fields in a repeater on that options page to add filters
    – Use those custom fields to dynamically create taxonomies in functions.php
    – Now when creating posts we can pick what taxonomies apply to that post
    – On the frontend pull in all taxonomies and use jquery to filter results

    Does this sound like a good game plan?

Viewing 20 posts - 1 through 20 (of 20 total)