How do I modify the position of a plugin?

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?

Topic css plugins Wordpress

Category Web


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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.