1

I am trying to modify a plugin but I'm a tech newbie. My plugin is for a floating mini cart. it's a great plugin but the position options are limited to "left-middle" or right-middle". I would like it to be shown in the "left-bottom" position of my site. I found an area in the plugin editor that mentioned it's current position (left-middle). I was hoping by simply changing the word "middle" to "bottom" it would work but it did not. What's the easiest way to achieve this? is there a simple css I could add to my theme to just over ride it's current position?

1 Answer 1

1

It's always bad practise to modify a plugin file. For one thing you will lose your changes when the plugin is updated. Look to see if your plugin has been created with filters (good plugins should be).

Search within your plugin for "apply_filters(" - With luck you will find this near the positional code. It might look something like this:

function cart_display() {
  $html .= '<div style="float-right">Cart position</div>';
return apply_filters( 'cart_display_html', $html );

This code is getting the contents (in the $html variable) ready for display, but also telling it to pass it through a filter called cart_display_html.

Within your functions file you can then hook into this filter to alter the display "on the fly". Using, for example:

function modify_cart_html( $html ) {
  return '<div>' . $html . '</div>';
}
add_filter( 'cart_display_html', 'modify_cart_html' );

There may well be CSS that can be used as well, likely simply overriding the plugins build in css.

2
  • Thank you so much for that info!
    – Grace
    May 4 at 12:02
  • ...and thanks for the upvote ;) May 4 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.