Skip Navigation

[Gelöst] Displaying content based on parameters

This support ticket is created vor 8 Jahre, 2 Monate. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Artikel
#337984
Screen Shot 2015-10-05 at 18.50.52.png
Screen Shot 2015-10-05 at 18.50.40.png

Hi Waqas

Im sorry to say that this didnt solve the problems.
Changing the parameter on the frontend (day) doesnt change the backend menu (night). See the images.

About the other problem I was referring to the IF statement not the general Views.

#338067

Waqas
Supporter

Languages: Englisch (English )

Timezone: Asia/Karachi (GMT+05:00)

I apologise if it did not fix the issue. But I think I have found the reason.

Please look at following code:

[my-shortcode time="Day"]My Shortcode Day Time[/my-shortcode]
[my-shortcode time="Night"]My Shortcode Night Time[/my-shortcode]

[wpv-conditional if="( $(wpcf-select) eq 'Day' )"]WPVDay Time[/wpv-conditional]
[wpv-conditional if="( $(wpcf-select) eq 'Night' )"]WPVNight Time[/wpv-conditional]

Do you notice any change in above code? I made a change actually.

The change is very minor and is around the first letter of words 'Day' and 'Night'. You were using 'day' and 'night' while the original field configurations are as 'Day' and 'Night'. Your JS function is also posting 'day' and 'night' while you were comparing for the same.

However, I didn't edit your JS, but edited the following function in your functions.php file:

function ajax_post(){
    global $control_panel_post;
    if ( isset( $_POST["time_var"] ) ) {
        // (this will need to be sanitized)
        $update_cf = ucfirst($_POST['time_var']);
        // testing echo
         echo $update_cf;
        //update post meta with the value from jQuery
        update_post_meta($control_panel_post, 'wpcf-select', $update_cf);
        die();
    }
}
add_action( 'wp_ajax_time', 'ajax_post' );

Please notice the function ucfirst(). I used this function to make first character of a string upper-case (hidden link), so it complies with the configuration of the select field.

Now I believe it works fine, as I have tested it for several times. Please check and confirm, thanks.

#338260

Hi Waqas

Yes its working perfectly now. Thank you for spotting this.
This task is now solved.
Shall I open a new one for the conditional IF or I add this last question here?
(how to visualise custom user fields into Views IF).

thanks!

#338430

Waqas
Supporter

Languages: Englisch (English )

Timezone: Asia/Karachi (GMT+05:00)

I suggest opening a new thread, so it can be reviewed and forwarded to the dev team. As fas as I can observe, the user fields may not be supported yet in that new visuals of this (since it's an ongoing work).

Thank you for your understanding and cooperation.

#338440

Sure,

thank you for the solution here.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.