Support

Account

Forum Replies Created

  • Tipically. Snippet to prevent duplicate slugs makes it.

    function bhrs_save_post_callback( $post_ID, $post, $update ) {
        if (in_array($postarr['post_type'], array('post', 'page', 'chronik', 'mitglied', 'galerie', 'vorstand', 'event')) &&
    !in_array($data['post_status'], array('publish', 'draft', 'pending', 'auto-draft', 'future', 'private', 'trash')))
    
            return;
        // unhook this function to prevent infinite looping
        remove_action( 'save_post', 'bhrs_save_post_callback', 10, 3 );
        // update the post slug (WP handles unique post slug)
        wp_update_post( array(
            'ID' => $post_ID,
            'post_name' => ''
        ));
        // re-hook this function
        add_action( 'save_post', 'bhrs_save_post_callback', 10, 3 );
    }
    add_action( 'save_post', 'bhrs_save_post_callback', 10, 3 );

    This one leave ACF slugs alone:

    // Force slug auto generate
    function myplugin_update_slug( $data, $postarr ) {
    if (in_array($postarr['post_type'], array('post', 'page', 'chronik', 'mitglied', 'galerie', 'vorstand', 'event')) &&
    !in_array($data['post_status'], array('publish', 'draft', 'pending', 'auto-draft', 'future', 'private', 'trash'))) {
    $data['post_name'] = sanitize_title( $data['post_title'] );
    }
    return $data;
    }
    add_filter( 'wp_insert_post_data', 'myplugin_update_slug', 9, 2 );
  • Experiencing same problem suddenly.

  • Sorry, I dare not to touch previous comment again, filter will kick in.

    This is a bit false, wrongly worded:

    – With ACF PRO deactivated CF7 works and send mails.
    – Or better to say, with CF7 JS scripts deactivated.

    – CF7 works nice with all CF7 JS scripts called on Page, without ACF PRO.

  • Adding: add_filter( ‘wpcf7_load_js’, ‘__return_false’ ); to the functions.php solves problem. But then what is the point, those are CF7 necessary scripts.

    It is worth for developers to take a look into this problem. Both plugins are installed on plenty of websites. I will repeat most important points:

    – Theme makes no problem.
    – Other plugins make no conflict (I tested with only CF7 and ACF PRO activated on Page.)
    – With ACF PRO deactivated CF7 works and send mails.
    – Or better to say, with CF7 JS scripts deactivated.

    – Uoploaded again source files of latest WP, CF7, ACF PRO.
    – wp-config.php and .htaccess files are OK.
    – No cache remains folders around.
    – mu-plugins folder clear.
    – SSL certificate, seems as, working OK.
    – Definitely not problem with mod_security or server firewall (or ?)

    I do not know what plugin is a bit away from WP coding practices. But the fact is ACF PRO is influencing CF7 form functionality, not the other way around. CF7 makes no problems for ACF PRO. Not visible anyway.

    Here is more from console:

    VM1350:1 POST https://www.some-site.org/wp-json/contact-form-7/v1/contact-forms/2584/feedback 403 (Forbidden)
    (anonymous) @ VM1350:1
    send @ jquery.js:4
    ajax @ jquery.js:4
    wpcf7.submit @ scripts.js:348
    (anonymous) @ scripts.js:56
    dispatch @ jquery.js:3
    r.handle @ jquery.js:3

    Hitting antispam filter on forum. Just to ad one more sentence to try again.

  • – It gives the same error with default WP theme ( how if there is no ACF display code ? )
    – Maybe worth to mention on localhost i do not have this error.
    – Error comes only by clicking Send on CF7 form. And icon spin for ever.

  • May I ask, if “Local JSON” folder in theme folder is so important for performance, why do you not create it in ACF plugin folder on install, and point code to look up there ?

  • Seems as groove planning problems, overly and unnecessary complicated.

    50 custom post types, says you have problems with ideas and imaginating website.
    On the fly is not possible to make them. As I am aware of it. Some developer needs to set all custom post types once and for all.

    ACF is not meant for styling (micro)themes.

  • I think you cannot with ACF. What do you want with it. Where should it be sent, displayed ?

  • I do not see “if” conditional there. Something like this, cannot test now.

    <?php if( get_field('youtube') ): ?>
    <?php 
    $field_name = ( ‘youtube’ );
    $field = get_field_object($field_name);
    echo $field[‘label’] . ‘: ‘ . $field[‘value’]; ?> <br>
    ?>
    <?php endif; ?>
  • Here is with new stylized True / False checkboxes. Tested and it works.

    add_action('acf/render_field_settings/type=text', 'add_readonly_and_disabled_to_text_field');
      function add_readonly_and_disabled_to_text_field($field) {
        acf_render_field_setting( $field, array(
          'label'      => __('Read Only?','acf'),
          'instructions'  => '',
          'type'      => 'true_false',
          'name'      => 'readonly',
    	  'ui'			=> 1,
    	  'class'	  => 'acf-field-object-true-false-ui'
        ));
    	  
        acf_render_field_setting( $field, array(
          'label'      => __('Disabled?','acf'),
          'instructions'  => '',
          'type'      => 'true_false',
          'name'      => 'disabled',
    	  'ui'			=> 1,
    	  'class'	  => 'acf-field-object-true-false-ui',
        ));
    		
      }
  • No, i was wrong. Even on other website, Beta RC candidate version, it is the same.
    Repeater has Instructions undel labels, not under fields. With Tab or without it.

    Is it maybe oversight when coded, or by purpose for some reason ?

    If it can be easy fixed please do it. Eyes visually allways experience as more orderly and harmonic if fields are in pixel inline, descriptions really doesnt matter so much if input fields line right.

  • I could use this example as improvement request. Despite ACF block is forced after Title give it some margin-bottom, as other meatboxes have.

    #acf_after_title-sortables .acf-postbox {
        margin: 20px 0 0;
    }

    to:

    #acf_after_title-sortables .acf-postbox {
        margin: 20px 0;
    }
  • I see now I forgot field in template to change function name. Easy done.
    And “supports” needs a bit of formatting. text_domain too.

  • I cloned completely Post Type generator from https://generatewp.com/post-type/.
    Something as my own helper and for my own use, not public. Those guys have very educative website and generators.

    77 ACF fields just for this part.
    Layout can be done much simpler then on their webiste, but decided for now not to use one row flexible content or repeaters. Maybe later when I get use to all this. Those two fields make preview template very long and complicate to visually follow, edit, add.

    And one custom code Metabox to preview template. Just called preview template with “require_once”, can be placed everywhere. Best solution, because it is set it ad forget it. Any code change in preview template is directly reflected in preview Metabox.

    It can be done easy, just need much time. I finished it for one day. Others will probably take much less time. I can reuse and adapt preview code template.

    Not “insert in editor content area” option, but not needed for this project.

    https://www.imageupload.co.uk/images/2017/07/11/2017-07-11_104027.jpg

    https://www.imageupload.co.uk/images/2017/07/11/2017-07-11_104057.jpg

  • Seems as it is possible.
    Just copy/paste HTML code of dashicon under “Field Label *”
    Tab Title <span class=”dashicons dashicons-editor-help”></span>

    or just icon without text.

  • I just needed it. No need to complicate. Or add unnecessary extra plugin and code.

    https://www.advancedcustomfields.com/resources/adding-custom-settings-fields/

    First snippet adds Admin only view (new option) for fields, second snippet remove it even from Admins. Do not forget to activate Admin only check option for second snippet to work.

    add_filter( 'acf/load_field/name=inscription_classe', [ $this, 'hide_field' ] );
    add_action('acf/render_field_settings', 'my_admin_only_render_field_settings');
    function my_admin_only_render_field_settings( $field ) {
    	acf_render_field_setting( $field, array(
    		'label'			=> __('Admin Only?'),
    		'instructions'	=> '',
    		'name'			=> 'admin_only',
    		'type'			=> 'true_false',
    		'ui'			=> 1,
    	), true);
    	
    }
    
    add_filter('acf/prepare_field', 'my_admin_only_prepare_field');
    function my_admin_only_prepare_field( $field ) {
    	// bail early if no 'admin_only' setting
    	if( empty($field['admin_only']) ) return $field;
    	// return false if is not admin (removes field)
    	if( !current_user_can('administrator') ) return false;
    	// return
    	// return $field;
    }
  • OK, I see now. Code knows it by Post ID column (post_id). It is “inherit”, and post type “revision”.
    Rest is date of course.

  • Can this idea be used somehow to replace this plugin ?
    (4 year old and we can freely say non existing.)

    https://wordpress.org/plugins/bbpress-post-topics/screenshots/

  • No.
    You cannot make permalinks like this and mix “/“, “” without heavy PHP magic.

    /grade-11/english to /grade-11/english-eng3u. Your field value (all of them) would need to have this sign “-“.

    You dont have so many language courses ? Even theoretically it they are in hundreds WordPress now manages Terms well. As long you dont use to many Select (dropdown) options Terms on shared hosting.

    Do it like this:

    – “grade 11” = (you use WooCommerce) Products main Category/Taxonomy/Term.
    – “english” = subcategory/Term of “grade11” main category.
    – “eng3u” = sub category/Term of “english” subcategory.

    Just simple nested categories and Terms. This is very reusable everywhere in WordPress for future website building, not like using fields. And Permalinks are generated naturally, no tweaks needed.

  • Still dont get it.
    It looks like perfect job for Terms (taxonomy terms). You can use ACF for other manipulation(s), Therms select field, etc…

    You dont have to worry about permalinks when working with Terms.

  • Can you explain in very detail what you need to make ?
    Some hidden pay content ? Booking ?

Viewing 25 posts - 1 through 25 (of 43 total)