Skip Navigation

[Geschlossen] Dynamically changing the Views

This support ticket is created vor 8 Jahre, 5 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
- - 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)

This topic contains 1 Antwort, has 2 Stimmen.

Last updated by Beda vor 8 Jahre, 5 Monate.

Assisted by: Beda.

Author
Artikel
#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

Das Thema „[Geschlossen] Dynamically changing the Views“ ist für neue Antworten geschlossen.