Skip Navigation

[Résolu] WP Views + Beaver Builders Integration – 1 Issue

This support ticket is created Il y a 7 années et 6 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. 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 15 réponses, has 2 voix.

Last updated by DavidAlexander Il y a 7 années et 5 mois.

Assisted by: Luo Yang.

Auteur
Publications
#446452

Great work on the integration with Beaver Builder, I especially love being able to replace a content template with a beaver builder template.

I have one problem however.

When using Beaver builder to directly edit a page and set the template it applies a beaver builder class to that page.

That means I can then use the below code in my functions

	if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) {
}

to check if a beaver builder template is active on a specific post or page and then hook in some filters or functions to remove unwanted surplus elements.

Now this still works, BUT it doesn't apply the class when this is set by creating a content template in WP Views, then using Beaver Builder for that content template and applying it to all of a specific post type.

Is there a way views can be set to inherit that class if it is active?

Thanks

#446476

Dear David,

Could you describe detail steps to duplicate same problem:
it doesn't apply the class when this is set by creating a content template in WP Views

I need test and debug it in my localhost, thanks

#446502

Hi Luo,

Sure, I can also show you an example.

Basically on this link hidden link where I have edited the page and used Beaver builder on the page means when you run

if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) {

It returns TRUE

However even though Beaver Builder is used to setup all single posts in the post type "workouts" the single post example hidden link returns FALSE with the same conditional statement.

I think the reason and difference is because the single post which returns FALSE is because we are 1) applying beaver builder to a WP Views content template and 2) auto applying that template to all single workouts.

Does the above make sense and do you see the difference? The site above is a development site so I can send you the logins for there if you wish?

Thanks

#446507

As I mentioned above, I need detail steps to duplicate same problem.

Where do you put the PHP codes into?

    if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) {
}

The URL you mentioned above:
hidden link
Is this archive page of post type "workouts"?

hidden link
Is this a single post of post type "workouts"?

#446802

I am using that if statement to remove the default page title IF beaver builder is active. So the usage of this differs from theme to theme, my function is within Genesis Custom PHP which is mimicking my functions.php

That is why it would save us a lot of time if you looked at the development site I have up and logged in there.

You can try that if statement with any remove_action for example to see it work on a page where you have set beaver builder but not when it is added to a views content template.

The URL I mentioned above:
hidden link
Is this archive page of post type "workouts"?

No - This is a static page where I have added a loop of the workouts post type as the default archives lack flexibility.

hidden link
Is this a single post of post type "workouts"?

Yes.

#447276

Since it is a custom PHP codes problem, if you can provide the detail steps to duplicate same problem, that will help us to find the problem.
where and how do you use the custom PHP codes:

    if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) {
}

What is the "Genesis Custom PHP"? is it another custom plugin?

I can not see anything return false in the problem page
hidden link

For example, if the conditional statement return true, which part of the page should not be displayed.

And you can provide a test site with same problem, and fill below private detail box with login details and ftp access, also point out where I can edit the PHP codes. I need to test and debug in a live website. thanks

#448612

Dear David,

Thanks for the details, the problem is not this:
it doesn't apply the class when this is set by creating a content template in WP Views

    if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) {
}

I simply create a custom shortcode in your website:
hidden link
line 40~45

add_shortcode('test_code', 'test_code_func');
function test_code_func(){
	if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) {
		return ' FLBuilderModel class &&  is_builder_enabled';
	}
}

Above shortcode will be able to output some text if the condition is satisfied.

edit the problem post:
hidden link
put above shortcode into the content:

[test_code]

And test it in front-end:
hidden link
You should be able to see it does output the result:
FLBuilderModel class && is_builder_enabled

So in the content template which is designed by Beaver Builders, your PHP codes should be able to work.

Then we come back to your PHP codes:
hidden link
line 31~38

add_action( 'loop_start', 'remove_titlesetc_bb_posts' );
function remove_titlesetc_bb_posts() { 
	if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    }
}

The actual problem is the action hook "loop_start" does not be triggered in the post:
hidden link

I suggest you contact your codes author for it, since it is out the range of Toolset, you can also contact our certified partners:
https://toolset.com/consultant/

#448999

Ah okay I see what you mean now. I added shortcode to both pages and see they match.

Very strange that my hook is inaccessible on that single post, I even tried other hooks I know are there and they don't work.

Does adding a content template to all of a post type remove the themes hooks? What hooks are definitely available that I could use instead?

Thanks

#449330

I contacted Beaver Builder support who came back with a very short response saying they think it is a theme issue.

I removed

if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) {

and it works, so it isn't a theme issue, its definitely either the way a views content template is applied OR a beaver builder issue.

Did you find this when you remove the conditional statement? it is then active on all pages and removes the items we want from the page with the problem. Can you help me point to the issue so I can go back to Beaver Builder and help them understand it isn't the theme?

Thanks

#449600

How do you do this?

I removed

if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) {

I tried to modify your codes in your website as below:

add_action( 'loop_start', 'remove_titlesetc_bb_posts' );
function remove_titlesetc_bb_posts() { 
	//if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    //}
}

Test it in front-end:
hidden link

I see same result, there isn't any difference between before and after modify the PHP codes.

So I agree with the Beaver Builder support:
it is a theme issue.

And the action hook "loop_start" does not be triggered in the post:
hidden link

Since it is a custom PHP codes problem, if you need more assistance for it, please make a copy of your website, I need test and debug it in my localhost.
https://toolset.com/faq/provide-supporters-copy-site/

#449930

Can you not see the difference before and after?

Now it is fixed because you removed the conditional.

Notice..

Before = Test Entry title outputs twice

After = Test Entry title outputs one (because the function runs and removes the genesis title).

I have isolated this and it is literally something within Types or Beaver Builder that is not working right. Since Beaver Builder also works 100% when Types isn't used it means this has to be down to the content template + beaver builder function.

Can you add the conditional back and refresh and tell me if you see two titles show again on this page?

#449932

I just retested this and it is different before and after. Are your eyes working? I don't understand how you could not see the difference? Can you elevate the status of this to someone else please as we are just wasting time and I need this fixed and know something is happening here because of Types.

#450001

Sorry, I missed that part, I have modified the codes as below:

add_action( 'loop_start', 'remove_titlesetc_bb_posts', 999 );
function remove_titlesetc_bb_posts() { 
	 if ( class_exists( 'FLBuilderModel' ) && temp_is_builder_enabled() ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
     }
}

function temp_is_builder_enabled()
{
	if(!is_admin() && post_password_required()) {
		return false;
	}
	else {
		$post_id		= get_the_ID();
		$content_template_id = get_post_meta($post_id, '_views_template', true);
		return get_post_meta($content_template_id, '_fl_builder_enabled', true);
	}

	return false;
}

Please test again, check if it is fixed or not.

#450008

Excellent! Okay so it was just a case of turning the feature on under page builder settings and you making the priority 999 that did it? That is all I need to keep in mind for future? I think this solution as it is so flexible with different themes that use hooks would be worth a tutorial.

Thanks for your help

#450009

Ah I also see that

if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() )

has also become

if ( class_exists( 'FLBuilderModel' ) && temp_is_builder_enabled() )

Is that anywhere in the docs? that would be worth promoting so people can use that when applying templates.

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