Support

Account

Forum Replies Created

  • I think so 🙂

    And if I echo the field labels manually in my template they should be in english right, because they’re template tags ?

  • Yes that helps a lot. It almost worked right as you wrote it, but this way also the values of the checkboxes are changed, so there needs to be one minor change.

    CHANGE

    
    $(".acf-field-123456789abc label").each(function(i){
    

    TO

    
    $(".acf-field-123456789abc .acf-label label").each(function(i){
    

    Then it works like a charm.
    Thnq.

  • Thanks, field names are always English. My site will most likely be in Dutch.

    I read through all the docs on ACF and WPML and since it was written in the WMPL docs that all template strings should be in English, I was doubting, since I echo all the field labels manually in my template… Hence…

    The field names are only shown when a user adds/edits a post (through the front-end).
    Knowing this, would you still advise to do it in Dutch or does this change it ?

  • Yes, I understand, but I can’t ‘write’ it. I’m not a hero with js…

    The reason I choose a repeater is too eliminate any typos or whatsoever.
    Now I know for sure all 7 days are ‘formatted’ the same and they’re properly grouped in the form.

    And I think it looks better, see http://i.imgur.com/jQ0krcI.png.

    Would you happen to know/have a solution ?

  • thanks @chrisriis for starting this topic. exactly what I as looking for.

    thanks @hube2 for the plugin. I created a pull request for it. I quickly made your plain strings translatable.

  • I have tested the provided script with and without the if function but can’t get it to work yet…

  • Thanks…. I have one question though…. My rows are set at min 7, max 7.
    Users can’t add a row himself…

    So am I right to assume this line won’t be working, since no rows are added ?

    
    acf.add_action('append', function( $el ){
    
  • This reply has been marked as private.
  • On a side note, since you don’t know the template system…

    This is Twig, combined with Timber which ‘adapts’ twig for WordPress.

    Definitely worth looking into… a lot faster than php and easier to change… since style and logic are separated.

  • just tested on twentytwelve and it works there… so i assume it’s my theme…

    i was using jquery v2.1.4, i now updated that to 3.1.0 and it works…

    which is the required minimum version jquery ?

  • AH ok… so i might need to move it more up…. before ‘<html>’…
    edit: just did but not changing anything….

    I might be able to give you an online link to look at but I need to upload it somewhere and send you the link privately because i don’t want to publish the (htaccess) passwords here since it’s not live yet.

  • It means if page has title ‘Submit’ include function acf_form_head.
    I took it out for testing, but still doesn’t change a thing.

    yes acf-input.min.js is called.

  • I did but didn’t change a thing…
    This is my code.

    
    {% if post.post_title == 'Submit' %}
        {{ function('acf_form_head') }}
    {% endif %}
    
    {{ wp_head }}
    </head>
    <body class="{{ body_class }}" itemscope itemtype="//schema.org/WebPage">
    {# {% include 'partials/google-tag-manager.twig' %} #}
    {% if post.post_title == 'Submit' %}
        {{ function('acf_enqueue_uploader') }}
    {% endif %}
    
  • I use timber so it’s a bit different…

    I added it to my header file (before wp_head) but then it seemed to output the form right there instead of where I wanted it to show.

    So I created a timberhelper in my page.php

    
    $context['submitform'] = TimberHelper::function_wrapper( 'acf_form', array(
        'post_id'           => 'new_post',
        'updated_message'   => 'Post successfully created!',
        'new_post'          => array(
            'post_type'         => 'my_post_type',
            'post_status'       => 'pending'
        )
    ) );
    

    and i then called it where i wanted it to show by using {{ submitform }} which shows it where I want it to show.

  • I am looking for something similar and I managed partially. I managed to ‘construct’ a new permalink, but it’s not working, it’s forwarding to home.

    I was trying to get the following permalink structure: /post-type/%post_id%-%custom_field_1%-%custom_field_2%

    That I managed with the code below. But the permalink itself forwards to home instead of the post itself.

    If anyone sees an error, or knows the solution, please let me know.

    
    function register_rewrite_rules()
    {
        global $wp_rewrite;
        $url_structure = '/my_post_type/%post_id%-%cf1%-%cf2%';
        $wp_rewrite->add_permastruct('my_post_type', $url_structure, false);
    }
    
    function my_custom_permalink($permalink, $post_id, $leavename) {
        $post        = get_post($post_id);
        $dvp_name    = get_field('dvp_name', $post_id);
        $dvp_city    = get_field('dvp_city', $post_id);
    
        $rewritecode    = array(
            '%post_id%',
            '%cf1%',
            '%cf2%',
        );
    
        if ( !empty($permalink) && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) ) {
    
            $rewritereplace = array(
                $post->ID,
                strtolower($dvp_city),
                strtolower($dvp_name),
            );
            $permalink = str_replace($rewritecode, $rewritereplace, $permalink);
        } else { // if they're not using the fancy permalink option
        }
        return $permalink;
    }
    
Viewing 16 posts - 276 through 291 (of 291 total)