Support

Account

Forum Replies Created

  • Hi Noëlle,

    This is not an answer, but I was looking up how to add the taxonomy columns to the admin – what did you use to do it?

    Ben

  • TYPO:

    When i said custom_field, i was referring to offers_code_cats_L2 – so they are interchangeable and one and the same.

  • I will give that a try and report back. A performance loss, in this case, won’t be a huge problem. This field will used maybe a few hundred times in a whole year. The data saved from the field will be used on pages, so more often than that of course.

    Each saved field from this will be used to show its name in a div on various pages. The only other data I’ll need is finding the category’s permalink and its parent category (if it has one), and if it’s a post, get its permalink, name, and parent category as well.

  • Thanks John.

    Do you have any ideas or guidance as to where to start on that? And it doesn’t even have to be a select, I just need to have a list that they can choose from that has those categories and those posts. This user will have no knowledge of which is which.

    If I absolutely had to I could use JavaScript to do something but it definitely would not be a best practice.

  • It won’t post my new question as it’s too similar to this reply. Does anyone know how to delete a previous reply I’ve made?

  • Awesome, thanks @rudtek! Doing that right now.

  • Hi all, and John,

    I am looking to do something I think is this, but not totally sure: I need one field the user chooses one value from, that is a combination of posts of category “dogs”, and also of specific categories themselves, “dogs”, “cats”.

    It seems that the Post Object and Taxonomy are the right choices, now I just need to merge them into one select. This field will be on the options page.

    I am trying the code John shared before:

    $all = array_merge(
             get_field('relationship_1', false, false),
             get_field('relationship_2', false, false));
    $args = array(
      'post_type' => 'speakers',
      'posts_per_page' => -1,
      'post__in' => $all,
      'orderby' => 'title'
    )
    $speakers = new WP_Query($args);
    // post loop

    But, trying I’m unsure how to go from
    $speakers = new WP_Query($args);

    to the new field of merged fields – I get syntax error with the snippet in my functions.php. Do i need to instead assign the merged array $args into a new ACF select field? I probably create that field, and assign the array to it?

    The data will be used on many different posts, and archive pages, that’s why it’s in my ACF Options page.

    Thanks.

  • 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');
  • 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!

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