[Jobs & Experts] custom template for [jbp-job-update-page] page

I want to make a custom page where I use this shorctcode [jbp-job-update-page]. I need to add there some text and make re-order.
After I updated the plugin, my changes will are lost.
During the chat we provide some mu-plugin but this does not work.
Can you help me with this one?

Thank you.

  • Panos

    Hi there Bo ,

    That shortcode seems to be using the template file :
    /app/views/job-form/main.php

    So you need to make a new file that will replicate that and do your custom changes. The best place for the new file's location is probably the mu-plugins directory (or you can create an entire custom plugin for this and store template files in your plugins directories). Lets make a new folder in mu-plugins called custom-layouts, this is where the new file will be located and it's path should be:
    wp-content/mu-plugins/custom-layouts/main.php

    Copy the original file:
    /app/views/job-form/main.php
    to
    /mu-plugins/custom-layouts

    Now you need to filter the layouts, so it uses the new layout file for that shortcode. Create a new mu-plugin for this, you can name it something like:
    jobs-layouts-filter.php
    and add the following snippet in that file:

    add_filter( 'ig_view_file', 'wpmudev_filter_ig_view_file', 20 );
    
    function wpmudev_filter_ig_view_file( $path ) {
    
    	$target_layout = 'views/job-form/main.php';
    	if ( $target_layout == substr( $path, strlen( $path ) - strlen( $target_layout ) ) ) {
    		$path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'mu-plugins' . DIRECTORY_SEPARATOR . 'custom-layouts' . DIRECTORY_SEPARATOR . 'main.php';
    		remove_filter( 'ig_view_file', 'wpmudev_filter_ig_view_file', 20 );
    	}
    
    	return $path;
    }

    Now you should be able to modify the new main.php file as you wish.

    Hope this helps :slight_smile:

  • Bo

    thank you, documentation of some kind would be VERY helpful. We need to make a number of custom changes to the Jobs&Expert plugin and the membership plugin. We want to be able to make all these changes properly so we can still allow updates, but we cant do that without using all the proper hooks. This one worked for making some minor edits to that template file, however we will be adding additional fields to the add a post form, changes to the post end date calendar, post open for, and number of other random edits needed. And my developer was having a really hard time getting the changes to work cause it was pulling code from multiple pages and didn't know all the proper hooks to make all the changes properly.