• Resolved psartorio

    (@psartorio)


    Hello,
    I have 2 ACF in my posts.

    1) Price_range
    2) Hide_price_range

    What I need is to show the Price_range in a Visual Composer custom grid ONLY if the Hide_price_range is checked.

    I also need to replace the Price_rage with a “Price on request” string if Price_range is empty or Hide_price_range is checked.

    Do you think I can do it using this plugin? Thanks a lot

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter psartorio

    (@psartorio)

    Sorry I made a mistake:

    *What I need is to show the Price_range in a Visual Composer custom grid ONLY if the Hide_price_range isn’t checked.

    Plugin Author Frederik Rosendahl-Kaa

    (@frederik-rosendahl-kaa)

    Hi @psartorio

    We all make mistakes.

    The plugin works such that if the field does not have any value and the label for the field is set not to be displayed then the field is not displayed.

    But I have also built in some different filter hooks that makes it possible to change the output that the plugin makes for a field.

    Hope it’s answer enough.

    If you need help using filter hooks then just write and then I will try help or if you have any questions.

    Best regards,
    Frederik

    Thread Starter psartorio

    (@psartorio)

    Hi @frederik-rosendahl-kaa thanks a lot.
    I need help do it ??

    Basically, I need to replace the output of the Price_range field with “Price on request” when:
    – Price_range is empty
    or
    – Hide_price_range checkbox is checked.

    Thanks in advance.

    Plugin Author Frederik Rosendahl-Kaa

    (@frederik-rosendahl-kaa)

    If you tell me what type of field you use for the price range then I will try and put something together that you can use.

    Thread Starter psartorio

    (@psartorio)

    Thanks @frederik-rosendahl-kaa

    Please take a look here:
    Schermata 2019-05-23 alle 09.05.05.png

    I hope you can help me ?? Thanks again

    Plugin Author Frederik Rosendahl-Kaa

    (@frederik-rosendahl-kaa)

    Hi @psartorio,

    You should be able to use the code that is included here.
    Just place it in your function.php file in the theme or child theme.

    The reason I made a space in $ output = “”; is because I discovered a bug in the plugin.
    But I expect first to have an update to the plugin during next week.
    Then it would be possible to remove that space

    I hope you can use the code otherwise you just have to write.
    But I write when I get the bug fixed in the plugin

    /*Hide price range if hide price is true*/
    add_filter('acfvc_text','acfvc8292_change_text_field_output',11,3);
    function acfvc8292_change_text_field_output ( $output, $field, $post_id ) {
    	if ( $field["name"] == "price-range" ) {
    		if ( get_field( "hide_price_on_property_detail_page", $post_id ) === true ) {
    			$output = " ";			
    		}
    	}
    	return $output;
    }
    Thread Starter psartorio

    (@psartorio)

    That’s worked like a charm! Thanks a lot for your help, much appreciated!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Display different texts based on conditions’ is closed to new replies.