Trying to override parent theme function in child theme

Hey guys!

I’m trying to override a parent theme function (top_bar_col2) in the child theme and having a bit of trouble with it.

First, though, a ‘higher level’ question: is there a particular reason that functions in the theme are not made pluggable? I see no ‘add_action’ associated with this particular function and many others while browsing the code.

SO, in trying to override the parent theme function I’m using the usual ‘remove/add_action’ code to the child themes functions file, but it’s not working and I’m wondering if there’s something I’m missing. My code (minus the actual code contained in the function:

function remove_top_bar_col2() {
    remove_action( 'init','top_bar_col2' );
add_action( 'init','remove_top_bar_col2' );

function custom_top_bar_col2() {

copy/pasted/modified top_bar_col2 code here

add_action( 'init','custom_top_bar_col2' );

Any insight is greatly appreciated!

Hey Keith,

I’ve already assigned another member of the team to assist you with your concern.


Ok, great! Any idea when someone may be able to look into this?

Hey Keith,

I swear I added someone to this thread but for some reason it didn’t push through. I just did it again this time and made sure it stuck. Sorry for the delay caused.


Hey Keith,

Great question! All of Beaver Builder’s code is object oriented, so we can’t make functions pluggable in the traditional sense.

Looking at the code, I can see how we could add them to actions. I’ve added that to our theme roadmap because it’s a great idea, but it’s probably more than we can deliver right now.

However, to achieve what you’re looking to do, we have these actions…


Those will let you insert content into the top bar’s columns.

Let me know if you have any questions about that.


Thanks for the reply! I get the actions, but what I’m trying to do is modify code that’s hard coded into a function. I originally posted this question with the ‘big picture’ in mind, but I think I may have to be more specific.

In the class-fl-theme.php file there is this line 468:

echo '<div class="col-md-6 col-sm-6 text-right clearfix">';

That same code is used in the footer, BUT my customized header needs some additional CSS to make it look correct however, I can’t use that class as it would also affect the footer.

My thought was to override the function top_bar_col2() code, which contains that line, so I could insert an additional class into that div and be able to style it differently than the footer.

How would you go about doing that?

Hi Keith,

Thanks for the detailed follow up. Unfortunately, it’s not possible to override that HTML at this time since it’s contained in a class. Sorry about that!

You could apply more specificity to your selectors to target only the divs in the top bar. For example, you could target them like this…

.fl-page-bar .text-left { 
    /* CSS for the first col */ 
.fl-page-bar .text-right { 
    /* CSS for the second col */ 

Let me know if you have any questions about that.