Support

Account

Forum Replies Created

  • I was mistakenly using that ^ which explains why it doesn’t work! Ha.

    I’ll look closer at using a taxonomy field, as you’re advice always steers me in the right direction.

    Thanks.

  • Hi John,

    Setting the meta_box_cb to false worked, thank you for that.

    For the save and load terms settings on the taxonomy, I need to add to the code for the custom taxonomies which i did not create using ACF – they are just coded.

    I looked and found that these should be the same as the settings in ACF:

    'capabilities'      => array(
    			'manage_terms'  => 'manage_trade_status',
    			'edit_terms'    => 'edit_trade_status',
    			'delete_terms'  => 'delete_trade_status',
    			'assign_terms'  => 'assign_trade_status'
    		)

    So i have added the above to the code for one of the taxes, and it does show the value on the post front end, but still does not save the value as seen in the admin columns. What else can i do or try?

    When i tried disabling the fields that are populated by the taxonomy terms, and creating them via ACF (because the settings you mentioned are right there), it created other issues like only getting the ID, instead of the value, and that would require lots of other coding to be changed in other places.

    Thanks.

    function cptui_register_my_taxes_trade_status() {
    
    	/**
    	 * Taxonomy: Trade Status.
    	 */
    
    	$labels = [
    		"name" => __( "Trade Status", "Avada" ),
    		"singular_name" => __( "Trade Status", "Avada" ),
    	];
    
    	
    	$args = [
    		"label" => __( "Trade Status", "Avada" ),
    		"labels" => $labels,
    		"public" => true,
    		"publicly_queryable" => true,
    		"hierarchical" => false,
    		"show_ui" => true,
    		"show_in_menu" => true,
    		"show_in_nav_menus" => true,
    		"query_var" => true,
    		"rewrite" => [ 'slug' => 'trade_status', 'with_front' => true, ],
    		"show_admin_column" => true,
    		"show_in_rest" => true,
    		"rest_base" => "trade_status",
    		"rest_controller_class" => "WP_REST_Terms_Controller",
    		"show_in_quick_edit" => true,
    		"show_in_graphql" => false,
    		"meta_box_cb" => false,
    		'capabilities'      => array(
    			'manage_terms'  => 'manage_trade_status',
    			'edit_terms'    => 'edit_trade_status',
    			'delete_terms'  => 'delete_trade_status',
    			'assign_terms'  => 'assign_trade_status'
    		)
    	];
    	register_taxonomy( "trade_status", [ "tradealert" ], $args );
    }
    add_action( 'init', 'cptui_register_my_taxes_trade_status' );
    
    /**
     * Populate the ACF field with terms from the custom taxonomy Trade Status type.
     */
    add_filter( 'acf/load_field/name=trade_status', function( $field ) {
      
        // Get all taxonomy terms
        $trade_status_options = get_terms( array(
          'taxonomy' => 'trade_status',
          'hide_empty' => false
        ) );
        
        // Add each term to the choices array.
        // Example: $field['choices']['review'] = Review
        foreach ( $trade_status_options as $option ) {
          $field['choices'][$option->slug] = $option->name;
        }
      
        return $field;
      } );
  • Thank you sir, as always, for the guidance.

  • The relationships are setup like this:

    – Related Fields Country, Continent
    — They are both ACF Post Objects, set to allow multiple, and to display on post types of Testimonial.

    So these are not set to show in blocks, but blocks are being used to display Testimonials as I am trying to and already in other custom blocks showing testimonials in some other way.

    I’m not sure if that answers your question, but i will also read about the link you sent of querying relationship fields.

  • Makes sense – i’ll look myself. All the instances of support with Bluehost have been a waste of time. They are not helping me see the logs – assuming i can see them in File Manager, do you know where i should look for them?

  • One idea i had, is to duplicate the ACF fields – the repeater three levels deep – and then delete all the fields except the one field that we are trying to update ( for roughly 400 listings). Maybe I could put that on an ACF options page, and link it to the other fields?

    That would be great if it worked, as they are launching by Friday, and this is the very last piece. It would still be problematic in the future when they want to update any of the fields on the page that won’t save. But if something like above worked, then down the road, other fields could be removed from that page and set on options page and linked in the same way.

    The other big hurdle is we spent so much time on this page – custom PHP, jQuery, CSS, HTML, (AND – all of it has a Hebrew version, most of which has to be manually duplicated then adjusted.) If we can somehow make it work without having to touch all the code for the most part, that would be amazing.

    I know you like to help and have helped me more than a few times, and I appreciate that – but I’d be happy to Venmo you something for helping with this.

  • I tried it with -1 and it go to your temp screen, then eventually stopped the timer – once after 20 minutes, I tried again and it was ~30 minutes.

    I did already have debug on.

  • Thanks John,

    I will try that. I assume the way to do that is by the filter you mentioned on the get hub page, like this:

    add_filter('acf/prevent-timeout/time', 'my_acf_timeout_time', 10, 2);
    function my_acf_timeout_time($time, $post_id) {
    
    	$time = -1;
    	return $time;
    }

    Is that correct?

  • Thank you both for replying.

    John, unfortunately your plugin did not work. I haven’t had a chance to troubleshoot as in disable other plugins, check logs. The temporary screen doesn’t appear.

    I also cranked the PHP settings by adding two zeroes to the already huge numbers I had the time-related settings to. That, and upon my advisement client switched to a higher tier hosting package, at Bluehost, and nothing has changed. Still get the same error, we simply cannot save the page.

    The hosting upgrade was also a nightmare as we ended up with all sites down for hours! It was almost as if Bluehost had never ever done that before.

    I told the client that we could upload all of the files that still need to be saved which is one PDF upload per row for 400 rows, via FTP, and manually copy and paste the file address into the database. I don’t wanna do that but I have to get this done with him somehow

    This site was Hebrew and English site which I did layer of complexity the whole way.

    The client does can use Selenium script to fill in the fields so yes I can get these fields working, the data entry part is easy. What boggles my mind is 10 fields and 400 rows all are now filled in and it’s just this one 11th field and most of those instances that needs a file uploaded to.

    I will take a closer look at seeing if I can get your plug in to work John because that is exactly what we needed.

    I know a little bit of mySQL but don’t write it, I know my way around phpMyAdmin though. I wonder if MySQL could be written in PHP MyaAdmin to insert the URL of each uploaded PDF into each row…

    What do you think?

  • While I have you, can you help me sort the floors so highest is first? It is this echo '<ul class="floor tower' . $grandparent_building . '">'; which is the floors. You can see the page here: https://briga.co.il/top-penthouse/briga-blue-bay/choose-apartment-simple/

    Thanks!

  • Got it – totally makes sense now. If i did want to do the exact same thing but with textarea, for example, would my filter still be acf/prepare_field/ or what filter would i use?

  • I got it all sorted and working! Thank you. I was thinking the field would be similar to a text area, where the text could be changed.

    How easy is it to have what is going to the new filed to display in a WYSWYG field? Maybe make a WYSWYG and set its default value to a shortcode (i’ll create it) that returns the value the new field is showing?

    the new field with concatenated fields

  • @hube2 I am still not clear – do i put the code in the template php file for the posts that have the fields whose values i am putting into the message field? And are we talking about the message field displaying its values on the front end or the back end? Backend is the goal.

    I added a message field – and it doesn’t have a name field, only label, so i named the label MESSAGE_FIELD_NAME and this field is on the same posts as the fields it’s supposed to be showing. When the post is saved and the page refreshes, that’s when i’m hoping to see the message field’s value, but there’s nothing.

    For some reason this hasn’t clicked for me yet. Can you help me more?

  • Hi John,

    I actually named my field just as you typed for simplicity’s sake, then will name it logically when working.

    I put your code in ‘functions.pho’ which I realize should be in the post instead. I’ll try again; thanks!

  • Thanks again John. I’m almost there..

    This is my code made from your last post:

    // get some values from Trade Alert Post, and put them in a message field for Jen to copy and paste into email / Jilt (/ eventually MailChimp maybe)÷
    add_filter('acf/prepair_field/name=MESSAGE_FIELD_NAME', 'change_message_MESSAGE_FIELD_NAME');
    function change_message_MESSAGE_FIELD_NAME($field) {
      $pair = get_field('pair');
      $buy_or_sell = get_field('buy_or_sell');
      $field['message'] = ($pair.' '.$buy_or_sell);
      return $field;
    }

    And i made another field a WYSWYG with a default value of [acf field="MESSAGE_FIELD_NAME"] thinking after post saves and refreshes, it would get the value, but no go. How would i display the $field from above?

  • Hi John,

    Thanks for the reply. I am working on it, and can you take a look? Something is missing i think.

    Also is $field[‘message’] what i use to get the field to show on the page?

    <?php
    function my_acf_prepare_field( $field ) {
    
        // Lock-in the value "Example".
        // if( $field['value'] === 'Example' ) {
        //     $field['readonly'] = true;
        // };
        // return $field;
        $buy_or_sell = get_field('buy_or_sell');
        $pair = get_field('pair');
    }
    
    // Apply to fields named "example_field".
    add_filter('acf/prepare_field/name=buy_or_sell', 'my_acf_prepare_field');
    add_filter('acf/prepare_field/name=pair', 'my_acf_prepare_field');
  • (posted twice accidentally)

  • Hi Elliot and all – I am uploading mov and mp4’s to a gallery, and it doesn’t display them at all. Is this because I am using the [gallery] shortcode? The code is straigh from the Gallery page examples.

    How can i tweak the code to display videos using the shortcode – or can I?

    Thanks!

  • I will try to – can you share the code you are using to get the titles? By titles do you mean the title attribute of images? If so and that’s working, then if I’m not mistaken (which often I am) you should be able to get url, alt, caption in the same way.

  • Thanks John, that helped. Now that I have that working, I have another issue, I will start a new thread here. Thanks for all your help, as usual!
    Ben

  • If I’m understanding you right, it sounds like you need the code from the Gallery field’s main page? I’ll paste it here.
    ‘<?php
    $images = get_field(‘gallery’);
    if( $images ): ?>

    <?php endif; ?>’

    https://www.advancedcustomfields.com/resources/gallery/

    Does that help?

  • Turns out – as usual with me – it was much simpler. I used a Woo shortcode that displays products (the way i wanted, with all the product details) and put it inside the loop that gets the PostID for the three products, set the PostID to a var, and it is almost working.

    It is working, except i need to adjust the loops syntax somehow:

     // check if the repeater field has rows of data
        if( have_rows('products_to_display_repeater') ):
    
            // loop through the rows of data
            while ( have_rows('products_to_display_repeater') ) : the_row();
    
                // vars
                $product_id = get_sub_field('product_complete_the_look');
                
                // get IDs from vars for Woo shortcode
                echo do_shortcode("[products ids='$product_id' limit='1' columns='1' orderby='date' order='desc']");
    
                // display a sub field value
                ?> 
                <?php the_sub_field('product_complete_the_look'); ?>
                <br>
                <?php 
    
            endwhile;
    
        else :
    
            // no rows found
    
        endif;

    The above works but because of echo do_shortcode("[products ids='$product_id' limit='1' columns='1' orderby='date' order='desc']"); I get three products each as 1 column and 1 row. I need one row with three columns.

    So the shortcode is being looped and called three times, once for each PostID. I need to only call the shortcode once and loop only the '$product_id' within the shortcode, thereby have three PostIds in the shortcode. Oh and they need to be comma separated.

    If anyone has input that’s great but I might figure it out…

  • Maybe I should be using the code from Woocommerce’s template archive-product.php as that page displays products the same way I need to. So maybe i should try that code as a starting point and replacing the appropriate pieces of code with ACF fields (the three products chosen on the product’s edit page.)

    Wanted to add that idea which i am still looking into deeper.

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