Suggestion for improvement to Appointments+

In Appointments+ it is looking for a page for each service provider. My site uses a CPT for service providers and so each service provider does not have a page but rather a custom post. Why not modify Appointments+ to allow me to select whether my service providers info is in a page, post, or CPT and then once I make this selection I can choose from the entries of that type? So in my case I would first choose the CPT Staff and then would be able to select from the list of posts in the Staff CPT. It just seems to make sense to me that a mid-size business will have a site with a CPT of Staff, Employees, Workers, or something rather than giving them all their own page or post.

  • wooster

    An example would be great. Thanks.

    I would hesitate to modify the plugin, so would this be something best done through my own plugin that can only be enabled if Appointments+ is active and then only uses the app_excerpt and app_content filters to modify things?

    Having looked at this I'm not sure the filters get at what I want to do. I want the custom post type to display in the drop down for selecting a bio page.

  • Hakan


    Here is a sample where 3 providers with ID's 3,5,7 have bios in (custom) posts 11,22,33. Change the numbers and add new providers as required.

    function modify_bio( $text, $page_id, $worker_id ) {
    switch( $worker_id ){
    case 3:	$post_id=11;	break;
    case 5:	$post_id=22;	break;
    case 7:	$post_id=33;	break;
    default:    $post_id=0;	break;
    if ( !$post_id ) return $text;
    $post = get_post( $post_id );
    return $post->post_content;
    add_filter( 'app_content', 'modify_bio', 10, 3 );
    add_filter( 'app_excerpt', 'modify_bio', 10, 3 );

    1. Provider ID is identical to user ID. If you are saving custom post ID in a user meta, then a simpler solution may be possible.
    2. The posts here can be custom posts, normal posts or pages. For WordPress there is no difference for them as regard to the content.

    Include this in functions.php of your current theme.

    Another possibility is just copying your custom post contents to pages and marking them as private or draft. The pages will not be visible to public, but their content will be pulled as provider bio. Then you don't need the above codes.


  • wooster

    Thanks Hakan.

    The proposed solution doesn't seem very elegant. It requires making a modification to code anytime a new employee is hired, and it requires knowing IDs which are not obviously discoverable for a novice. Copying CPTs to posts defeats the purpose of having CPTs and would result in a duplication of data in the DB. There is also the fact that my CPTs have a custom page template and collect custom information. I'm going to try playing with app_pages_filter since this seems much more like what we want to do. We want to let the user decide on using a CPT and if it can be extracted out to a plugin then there is no mucking with code. It may even be possible to allow the user to specify post_type either in a drop down or a simple text field.

  • wooster

    It seems that get_pages will not return CPTs even if you set the post_type argument. I ended up replacing $pages with

    $pages = get_posts(array('numberposts' => -1,'orderby' => 'meta_value','meta_key' => 'it_last_name','order' => 'ASC','post_type' => 'itpeople'));

    This works for me but is not going to work for everyone. I think adding a couple of settings would work. Let the user choose if they are going to use pages, posts, or CPT. If they are going to use posts then let them select a category that contains all the employee posts. If they are going to use a CPT then let them select from all the available CPTs.

    The change to the current code would be an if or switch that checks to see if we are using pages, posts or CPT. If we are using pages the $pages line stays the same and if we aren't then for CPTs the line becomes

    $pages = get_posts(array('numberposts' => -1, 'post_type' => $cpt));

    where $cpt is the CPT they selected in our new options. For posts it would become

    $pages = get_posts(array('numberposts' => -1, 'category' => $cat));

    where $cat is the category they selected in our new options. It would then be nice to allow the user to filter the arguments of get_posts to add ordering, meta_key, etc.

  • AngelasBoutique

    I need a solution to this, as well -- my Services are in Posts instead of Pages (that's how my theme is built and I can't change it). I have gone through several posts from others in this forum who desperately need this functionality as well (to choose Pages, Posts, or CPTs for the Services and Providers). Please see about an update to the plugin as soon as is humanly possible... that would be most beneficial to us who can't even use the plugin we paid for!

  • aecnu

    Greetings AngelasBoutique,

    Thank you for your feedback which is certainly appreciated.

    Thanks for bringing this up, it certainly sounds like a useful customization to the plugin.

    Unfortunately, it is not currently available - but we would love to put it into consideration for future development

    I have moved this ticket to the applicable feature requests area and I have alerted the lead developer to the request.

    It might take a bit longer than useful but alternatively, you could see if there's a developer available at wpmu jobs who could get onto it right this minute

    Thank you for being a WPMU DEV Community Member!

    Cheers, Joe

  • Vladislav


    This change is actually already queued for the next plugin release, made to work with the new Add-on system. I'm attaching a working Beta with this feature built-in, if you'd like to take it for a spin.

    To change the actual post type used for your Services descriptions, you'll first want to activate the add-on named "Service Description post type" (you can do so on the new tab titled "Add-ons" in the plugin settings). Once the add-on is activated, you can select the post type you want to use for service descriptions in Settings > General > Advanced Settings.

    The procedure for changing worker biographies post type is similar, but you'll want to enable the add-on named "Biography post type" for this.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.