Who can we get Service Provider ID from associative page id?

Hello Support,

Thanking you for your quick and valuable support.

I have confirmed my system with Service Provider. Each service provider has its own Bio page. I would like to make id dynamic. So we have to just change 'provider_id="6"' or worker="6" where "6" can be any.

At the template page we will get current page id, so is any way to determine for what user current page is assigned?

e.g. John is service provider and his bio page has id as "1122"

At the theme page i will get current page id with the help of function "get_the_ID()". I would like to know for which user this page assigned

Can you please help me?

  • Predrag Dubajic

    Hey @sandeepa,

    Hope you're doing well today :slight_smile:

    I'm reading this over and over and I must admit that I'm not sure what exactly are you looking to accomplish here, sorry :slight_frown:

    Could you please provide me with some more info about your request, how should this setup work, what should happen where and when, and any other info that could help me to wrap my head around this.

    Please let me know so I can try and assist you further with this.

    Best regards,

  • sandeepa

    Hello Predrag,

    Ok, let me explain again. We have screen at admin named as "Service Provider". Here we are adding new service provider and assign Bio page to respective service provider.

    Here we are taking users and Bio page from Drop down, once we create new service provider, it will have new ID "X" and this "X" will be used as works or provider ID in Shortcode definition.

    Now what we want to do, once client visit Bio page of any Service Provider, is any way to determine for which user (Service Provider) this page has been assigned?

  • Predrag Dubajic

    Hey @sandeepa,

    Thanks for the additional info, I was aiming that way but wasn't sure if that is what you are asking for.

    There isn't anything in the plugin that will tell you to which service provider current page is allocated but you can always add the image and heading to bio page and that way personalize the page and the visitors will know to whose that page is.

    Best regards,

  • sandeepa

    Hello Predrag,

    Thank you for your information. I know I can personalize Bio page via admin. But I have to show Respective Service Provider Appointments. User can make appointment from XYZ's bio page, for only service Provider as "XYZ". I know I have to add "worker=ID" in shortcode.
    But here I have to copy service provider id and manually place at each Bio page.

    What I was planning, once User visit on Bio page,
    1) Find Page ID
    2) From that page ID - We was planned to retrieve service provider ID, as this is one -to - one association.

    Anyway, I think its not possible unless more customization.

  • Adam Czajczyk

    Hey @sandeepa,

    I hope you're well today!

    Let's get this cleared out a bit:

    There's "one-to-one" association between service provider (or worker) and a bio page. You can place a shortcode an a bio page that would display a calendar for this service provider or worker. This would require you to "manually" put an ID as shortcode parameter.

    What you wish to achieve here is to make the "bio page template" automatically determine which service provider/worker calendar to show? So, you'd like the ID of worker/service provider to be passed automatically from "appointment booking" page to a bio page. Am I correct?

    I'm sorry for asking this again but sometimes the simplest things seem complex at first and I'd like to be as specific as possible with my answer :slight_smile:

    Please advise!


  • Adam Czajczyk

    Hey sandeepa!

    Thanks for clarifying it!

    It's totally doable with a little customization. I've attached a .zip file for you to this post. To make it work, please follow the steps below:

    1. download and unzip the archive
    2. upload the "dynamic_providers.php" file to your active theme's folder
    3. add this line to your theme's functions.php file (preferably at the very end):

    /* custom App+ "dynamic bio page" extension */
    require get_template_directory() . '/dynamic-providers.php';

    4. Create a custom page template for your "bio pages" the same way as any custom page/post template for WP


    5. Put this code into your custom template file in place where you want the calendar to be shown:

    	$app_provider_shortcode = '[app_monthly_schedule worker="' . htmlspecialchars($_GET['appsdid']) . '"]';
    	echo do_shortcode($app_provider_shortcode);

    6. Go to your WordPress dashboard and create Bio Page(s) for service providers, set those to use your custom created template

    7. Go to "Appointments" -> "Settings" -> "Service Providers" and assign "bio pages" to service providers.

    8. Put the following shortcode on any page that should display service providers drop-down list:

    [app_service_providers_dynamic provider="3"]

    The "provider" attribute sets default provider to be selected. Put any ID of an existing provider here or simply omit it (and use [app_service_providers_dynamic]).

    How does it work?

    The [app_service_providers_dynamic] shortcode is described on the "Appointments" -> "Shortcodes" page in your dashboard. It creates a drop-down list of providers and after submitted redirects user to a page associated with service provider.

    The part that you add to a page template simply receives the providers ID and executes shortcode that displays calendar, thus dynamically creating it.

    This also make it possible to create completely custom "bio page" template that would for example fetch Service Provider's bio from associated WP users bio or custom fields. This way you could create only one "bio page" associated to all providers and let WP dynamically fill it with a content. This however is way beyond the scope of this forum :slight_smile: I think though that you get the idea!

    Please note also, that this code does not alter plugins code in anyway so updates should be relatively safe, unless plugin is completely rewritten. It's been tested only with a newest Appointment+ plugin and Twenty Fifteen theme.

    Let me know how it worked for you!


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.