Changing Behaviour of a Wordpress Plugin - wordpress

Im new to wordpress plugin development. I want to be able to change the behavior of another wordpress plugin. Is there a good way to do this. ie. Should i create a new plugin to override its behavior, or should I change the plugin directly. If anyone else has some good tips for wordpress plugin development, please let me know.
Thanks

Easiest would be to just edit the plugin's source directly then modify its version number to something high like 99999 so that you won't mistakenly update it through WordPress and wipe out all the edits you've made (that happened to me).
Better would be to make another plugin that will modify the behavior of the original plugin, or code it in the functions.php of the theme if the change is minimal, or just edit the plugin's code then rename it to a different plugin (as plugins hosted at WordPress are GPL2-licensed).
Use, WordPress' remove_action function to remove the original plugin's hooks then redeclare them using your own functions using add_action.

Related

Wordress - How to work with non wordpress theme

I'm new to wordpress, and I want to know if it is possible to put a theme bought on shapedtheme.com for example on an existing wordpress.
And if so, how to do it. I don't know where to put the code of the theme. I saw the wordpress page builder with text, but I see tags with [] and not <>.
I saw on this thread that pages can be linked to php files. I don't see how.
I have full access to the hosting service's filesystem and can see all wordpress files.
I would also like to transpose the theme header and footer and if possible, use the theme cards to adapt to blog articles written in wordpress.
How can I do this ?
I searched for tutorials on google or related threads on SO with no luck.
Any ressource would be appreciated.
Thanks to anyone who will take the time to read/answer this post.
No, you can't use a non-WordPress theme in a WordPress installation since WordPress will look for specific templates and pass certain objects to the template to be displayed.
You could adapt it to work with WordPress, though. Here's the theming guide to get you started.
But you'll probably be able to find a WordPress-ready theme with the features you want. This is the WordPress theme directory link for themes using bootstrap.
Unless you go for a from-scratch development of a pure php theme, and you need some level of theme customization I'd strongly suggest looking into child themes, as it'll allow you to update the base theme minimizing the changes you'd have to do to yours.
The [ ] syntax you mention are shortcodes, small, safe php functions that can be executed by inserting them in the editor, templates, etc, and provide kind of an api that exposes WordPress or plugins functionality.
And regarding your link, OP already has a WordPress theme, but is looking for a way of using a different, specialized template on specific pages. This template still has to follow to certain WordPress conventions.

Modifying a template part don't do anything

I try to modify a theme in WP and I just noticed that modifying a template part doesn't do anything. How is that possible? Tried on different browser to check if its cached and its not, how do I modify a theme part?
I'm using Academia Theme with LearnPress Plugin. I've made a Child theme and I'm trying to modify a file that is a theme part called content-course_list.php which is exactly the html that appears in the segment I want to modify. I just try to change a simple text that is "Read more". I found it, changed it and it doesn't update. I even put it in the child theme folder to make sure it gets it from there and nothing..
I don't use any cache plugins and the host is local (xampp).
It seems the theme has a "core" plugin (academia-core) as well, where its using some shortcode templates for parts of the website. I managed to find the text by its css class (found with chrome inspect in the page) while I searched in all the php files from theme and plugins. I hope this answer helps someone in the future.

how can i edit the look and position of wordpress searchbar?

I am using a premium woocommerce theme.I don't like the position and look of the search-bar.Its tiny and I want to make it look like Google search-bar.So I want to change it.I don't know coding that well.What specific thing should I do to make it happen.What coding language I have to learn to do this?
If you are lucky the Premium WooCommerce theme which you have bought must have an option to add Custom Code(CSS) through the WordPress dashboard itself.
If not please go through the following procedure:
You can change the look and position of the WordPress searchbar using CSS. In order to add the CSS to your WordPress site you need to know basics of PHP how exactly WordPress works.
You need to enqueue style in theme's(Creating a child theme of your theme is more preferable to avoid the loss of code due to theme update) function.php file or using you own custom plugin.
Both these options are given in details in this link.
Languages you need to know:
PHP, CSS
You need not have to be master of PHP to do the changes just the basics of php is fine.

Wordpress plugins are not working

I created a wordpress theme.But plugins are not working in my theme.
Is there any function to be registered in order to work plugins?
every theme should have a call to wp_head() somewhere in the section of the output page. This allows a plugin to "hook" into your ```, and for example, output code to load its Javascript
If you have properly installed plugins foremost work is to activate them.
If you have not activated your plugin then go Plugins=>Installed Plugins
There you will find all the plugins you have installed and you can Activate from there, from the ACTIVATE link under the Plugins' name.
In case you have installed and activated the plugins. Then you need you need to use its shortcode on pages to use it.
In case you want to use it in some php file of your theme then you need to place its "php" code at proper place in order to get its result.
Hope you get it how we use Plugins in wordpress.
Also wp_footer() is required on the footer before the end tag of to load required javascript files you enqueued.
Did you make your plugin header right?
Take a look here:
https://codex.wordpress.org/File_Header

How can update my theme and plugins without losing my changes?

I am using wordpress! I have certain pluginsthat i use that I personally modified and made changes to.
I have even made edits to css files as well
I heard if you update the files , (when a update becomes available) the updates will overwrite the changes you have made
how can I avoid this?
**The theme I am using is not a child theme i believe
When updating WordPress, no theme or plugin files (except for the default WordPress themes maybe) will be overwritten.
When updating a plugin, plugin files will be overwritten indeed. A possible solution is – when that plugin is using hooks – to unhook and than re-hook them with your own copy of that function in the functions.php file of your theme. Furthermore, there is not much you can do.
With themes, it is best to create child-themes.

Resources