Skip Navigation

[Closed] Dynamically changing the Views

This support ticket is created 8 years, 5 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Beda 8 years, 5 months ago.

Assisted by: Beda.

Author
Posts
#344961

I am trying to:
dynamically changing the Views.

Once some conditions happen, the Views need to update the values passed.
for example,
Im building up a menu with a View. If the user is logged in a different menu will show up.
I know I can make two different Views, but the conditions are quite many, it would be more useful to be able to pass the data dynamically.

thanks

#345065

Thank you for contacting us here in the Support Forum

1. Im building up a menu with a View. If the user is logged in a different menu will show up.

Depends where you put that menu you can either laid a different View or a View with some other ShortCode parameters using wpv-condtional.
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

To load different WordPress menus itself, consult the WP API (example below)

function my_wp_nav_menu_args( $args = '' ) {

        if( !is_user_logged_in() ) {

            $args['menu'] = 'unlogged'; //the name of your menu for not logged users

        }
		elseif( (is_user_logged_in() ){
			$args['menu'] = 'logged'; //menu for logged in users
		}

        return $args;

} 
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );

I belive I replied to you with the possibilities you have for Views in this thread:
https://toolset.com/forums/topic/how-to-pass-variables-to-views/

Please let me know if you need further infos about this.

Thank you

The topic ‘[Closed] Dynamically changing the Views’ is closed to new replies.