Hi,
I am using Toolset Starter Theme + Layouts.
I wanted to attach a layout to a third party custom post type "job" from the Plugin WP Job Manager.
The WP Job Manager Plugin is pulling single.php and adds its own code to the content of the post. (usually)
With Layouts enabled and a Layout attached to the CPT the single view of a job gets added multiple time.
I read quite a few things about it, but cannot solve it on my own I guess. The problem is related to WP Job Manager using the_content if I am right. I would need a bit help to figure out how to avoid this: hidden link
It shall be added only in the real content I would add via a content template in the layout.
Hints and ideas are welcome 🙂
Dear lars,
I suggest you add a content template cell into your layout, and use shortcode [wpv-post-body] to display the post content, add attribute "suppress_filters" like this:
[wpv-post-body view_template="None" suppress_filters="true"]
More help:
https://toolset.com/documentation/views-shortcodes/#wpv-post-body
suppress_filters (opt):
'true' | 'false' (default)
If suppress_filters=’true’, all third party (non WordPress) filters hooked into the_content filter will be removed, when retrieving the post body. In certain circumstances, plugins using this filter can add duplicated content to the post body – removing the filters can resolve this problem.
Hi Luo,
thanks for the assistance.
The filter suppression is already activated.
To clear more things up. The layout is not used at all. Nowhere in the link I sent you is the layout I use.
So the Plugin is adding its things not only to the post body, but to EVERY SINGLE element I created with the layouts plugin. Also the parent layout.
The 3rd Party plugin is using it's own templates. Get's the data from single.php and adds things. But it seems it has a bigger problem here with something.
Thanks for the details, here is what I found, in the file of plugin \wp-job-manager\includes\class-wp-job-manager-post-types.php, line 300:
$this->job_content_filter( true );
modify it to:
//$this->job_content_filter( true );
and test again.
This is almost perfect Luo!
Thank you!
It somehow still overwrites the content to the first layouts item. which would be a simple link in a visual designer field.
Thanks for the direction in any case!
I suggest you remove the built-in filter of wp-job-manager plugin completely:
1) modify the file of plugin \wp-job-manager\includes\class-wp-job-manager-post-types.php, line 276 as below:
//add_filter( 'the_content', array( $this, 'job_content' ) );
2) and create a custom shortcode for display the "Apply for job" button, add below codes into your theme/functions.php
add_action( 'after_setup_theme', 'layout2job_func', 99 );
function layout2job_func(){
global $job_manager;
add_shortcode('job_content', array( $job_manager->post_types, 'job_content'));
}
3) Then use the shortcode [job_content] in the content of visual editor cell