• Resolved Cacique

    (@carlosjavier10)


    First of all good morning, I need to display a directory with hidden filter where the members of each country that I set as an extra field in buddypress are displayed, the hidden filter “profile search” works very well, but I am forced to create 60 pages for the 60 countries, it occurred to me to pass to a single page the name of the country as a parameter by get, but I can not make it work, I tried adding a small shortcode to receive the parameter and also to print the shortcode directly but none of that worked! I am not an expert (obviously) but it would be a lot of abuse if you give me some idea of how to achieve this? thank you very much in advance.

    in short, the idea is to use your shortcode but with parameter. example: [bps_directory field_24=”($PARAMETER) “]

    Thank you very much in advance, I hope it doesn’t bother too much.

    Translated with https://www.DeepL.com/Translator (free version)

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Andrea Tarantini

    (@dontdream)

    Hi carlosjavier10,

    Instead of using [bps_directory] you could use the ‘bps_hidden_filters’ hook, as follows:

    add_filter ('bps_hidden_filters', 'my_hidden_filters');
    function my_hidden_filters ($filters)
    {
    	if (!empty ($_GET['country']))
    		$filters['field_24'] = $_GET['country'];
    	return $filters;
    }

    Add the above code to your bp-custom.php file, then call your members directory:

    https://iwkassociation.com/members/?country=France

    Thread Starter Cacique

    (@carlosjavier10)

    Here in my land we say “NA GUARA” when something impresses us a lot, and NAGUARA Andrea you are a SUN, thank you very much indeed! i tried it in local and it worked the first time. now i am going to take it to the domain. thank you very much.

    Plugin Author Andrea Tarantini

    (@dontdream)

    You’re welcome, thanks for your kind words!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘shortcode with parameters’ is closed to new replies.