Skip Navigation

[Resolved] Third Party Plugin Content is added multiple times

This support ticket is created 8 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 4.00 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 8 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#433137

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 🙂

#433401

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.

#433472
2016-09-07_0858.png

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.

#433486

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.

#433493

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!

#433520

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

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.