Custom wordpress plugin shows update for new blank plugin - wordpress

Does anyone know how to fix this issue when building custom wordpress plugins?
The file directory is plugins/twitter/autoload.php with the autoload.php containing the following items:
<?php
/**
* Plugin Name: Twitter
* Description: Showcase Twitter feed using Gutenberg Blocks.
* Version: 1.0.0
* Author: Test
*/
Does anyone know why my custom plugin with nothing inside of it yet is showing that it needs an update? When I update the plugin, it grabs files from some other twitter plugin and overwrites all of my files.
Is there a naming issue? Can two plugins not have the same name? This was't an issue when I was building an Instagram plugin.

WordPress updates pull from the WordPress plugin repo and this means it matches and existing one. You need to rename the folder to avoid this.
You can also click on the View version details to see what it is matching against.

Related

Can we redo a plugin published on wordpress.org and disable update for the user who has it already installed on there site

I have the plugin on wordpress.org I want to redo that plugin, but when I redo that plugin it will be the same plugin but I can't migrate old plugin user to this new plugin, so I want to disable the update for the old users of this plugin so they continue to use the old plugin (and migrate on their own risk) but it should not auto update for them
You can change the plugin version in wp-content/plugins/your-plugin/your-plugin.php to something like:
* Version: 9999
Every plugin has comments at the start of the plugin's file that gives wordpress information. e.g
/**
* Plugin Name: the name of the plugin
* Plugin URI: https://wordpress.org/plugins/plugin
* Description: blah blah
* Version: 9999
* Author: author etc
**/
By adding version 9999 wordpress thinks that your plugin is updated so it wont be shown as a plugin that needs update.
Hope this trick helps you.

How to upload totally custom PHP/web files into WordPress?

I know PHP but not much WordPress, and I need to upload a collection of files into my client's WP site. I'm wanting something a little different from what is being asked in this SO post.
I need to upload a collection of totally custom files, including PHP, html, js, and css files. Ideally I'd love to upload a zip with my collection of web files, with folder structure maintained. These files have nothing to do with the WP site, in that they don't need to hook in to the menuing/plugins/themes, etc. They are standalone files with custom functionality, I just need to launch my "main" page when a certain WP button is clicked.
Is there a way to upload a zip file through the WP admin interface and have it extract my files into a safe/isolated location?
How will I know the absolute or relative URL to my main page, after this upload occurs?
If 1 and 2 above are impossible, what's the best approach to get my files up there, in some kind of isolated folder? (I really don't want to create/modify themes or plugins if possible, I just literally want to dump some files onto the server and then know how to access them via URL.)
Note: If I had access to FTP on my client's server, that would be the easiest approach by far, but that is not an option, and my only doorway is the WP admin interface. This is a hosted wordpress site (version 4.7), hosted by Wordpress.com, and it's the Business Plan.
EDIT:
Here is Zero Gravity Payment Module.php:
<?php
/**
* #package ZeroGravityPaymentModule
* #version 1.0
*/
/*
Plugin Name: Zero Gravity Payment Module
Plugin URI: https://www.zerogravpro.com/CCPayment/
Description: Advanced Authorize.Net credit card payment form built by Zero Gravity Programming.
Author: Nate Jensen
Version: 1.0
Author URI: https://www.zerogravpro.com/
Text Domain: hello-dolly
*/
?>
And here is installer.php:
<?php
$destinationDir = $_SERVER['DOCUMENT_ROOT'] . '/' . 'ZeroGravityPaymentModule';
mkdir($destinationDir);
$zip = new ZipArchive;
$zip->open('ZeroGravityPaymentModule.zip');
$zip->extractTo($destinationDir);
$zip->close();
?>
I was able to upload my "plugin", but now cannot seem to find my php files via absolute url. I have tried the following locations:
https://[actualdomain]/wp-content/plugins/Zero%20Gravity%20Payment%20Module/installer.php
https://wordpress.com/view/[actualdomain]/wp-content/plugins/Zero%20Gravity%20Payment%20Module/installer.php
I have tested this answer end to end and it works. However, it now transpires that this question relates to Wordpress.com which provides modified/restricted versions of Wordpress - see edit at bottom of answer.
It can all be done with 2 miniscule scripts.
i: "mydummy.php" contains just a single comment on its own line (necessary to "fool" WP into uploading your actual script and archive file).
<?php
/* Plugin Name: mydummy */
?>
ii: "myinstaller.php" e.g.
<?php
$destinationDir = $_SERVER['DOCUMENT_ROOT'] . '/' . 'myparentdir';
mkdir( $destinationDir, 0775); // 0755 whatever
$zip = new ZipArchive;
$zip->open('myarchive.zip');
$zip->extractTo($destinationDir); // creates dirs and files below as per archive structure
$zip->close();
?>
Tested and works. Add your own error handling & info/progress msgs as required (you are familiar with php).
To upload and run:
Create a zip (e.g. myarchive.zip) of the directories and contained files you want to place on your server.
Place this zip and the 2 script files above in a folder called "mydummy".
Zip the "mydummy" folder" (the result should be "mydummy.zip" containing folder "mydummy" with your archive, myinstaller.php & dummy.php in it.
upload mydummy.zip via Wordpress admin: Plugins->Add New->Upload File. Dont bother activating. Your script and archive are now uploaded to (/maybe-path-to) /wp-content/plugins/mydummy.
run your script http://example.com/wp-content/plugins/mydummy/myinstaller.php JOB DONE
delete plugin, scripts and archive: via Wordpress admin: Plugins find "mydummy" and click its delete link
File perms shouldn't be a problem (I assume server will ensure files are 644 by default etc) the owner will obviously be the same as Wordpress - this should not be a problem for browser access.
Edit:
A common response to Wordpress.com questions is to advise contacting their support; and on a paid plan I would hope you get better answers from them than here. My knowledge of this host is near zero - I vaguely recollect its sites use a restricted variant of Wordpress and that on some(?) plans only specified plugins can be used.
You will need to build it as a WordPress plugin. Otherwise, it won't
work inside WordPress.com's structure.
If they mean the upload will only take place if there is a functioning plugin then try replacing the empty dummy plugin in my first answer with this:
<?php
/* Plugin Name: mydummy
Plugin URI: http://example.com
Description: do nothing plugin
Author: me
Version: 1.0.0
Author URI: http://example.com/
*/
$donothing = 0;
?>:
However; if they mean scripts will only execute if called by "Wordpress" you need to add extract code to plugin but ensure extract only occurs once not every time someone visits the site. In plugin, replace $donothing = 0 with:
function site_perm_function() {
// your code to create html string of dirs (e.g. root and current) + their permissions
// return permission string
}
add_shortcode( 'display_my_site_perms', 'site_perm_function' );
function install_function() {
// your code from myinstaller.php above with code to build message string from statement errors/results
// return message string
}
add_shortcode( 'myinstaller', 'install_function' );
Create a new zip and try installing and ACTIVATING plugin and. If OK:
Open the post editor to create a dummy post.
In the post editor insert the shortcode [display_my_site_perms] then preview the post - this should display permissions.
If permissions look OK for unarchiving then add shortcode [myinstaller] to the post and preview again - this should do the install.
Hopefully it will work, but not tested and I have zero knowledge of Wordpress.com.

install theme to style wordpress admin

I am trying to figure out how to install this theme to style my wordpress admin.
Does anyone know where in the root to install these files?
http://themeforest.net/item/avenxo-responsive-angularjs-html-admin/11660185
Thanks
First of all there are two ways of making a WordPress Admin themee: with a Plugin or by simply changing the CSS.
In this case, it recomended to make a new plugin because Angular Js needs more file js to works fine. Then this file js must be included in the core of wordpress.
Here is an example to init and activate a new plugin in wordpress:
<?php
/*
Plugin Name: My Admin Theme
Plugin URI: http://example.com/my-crazy-admin-theme
Description: My WordPress Admin Theme - Upload and Activate.
Author: Ms. WordPress
Version: 1.0
Author URI: http://example.com
*/
function my_admin_theme_style() {
wp_enqueue_style('my-admin-theme', plugins_url('wp-admin.css', __FILE__));
}
add_action('admin_enqueue_scripts', 'my_admin_theme_style');
add_action('login_enqueue_scripts', 'my_admin_theme_style');
?>
I hope this help,
best regards
Please consider to give a look at WordPress Codex. Note the answer by #Stefano Tux points you to the right direction.
Hope this helps

Edit wordpress Shopp plugin to enable promo-code input

I want to enable a promo-code input box for the Shopp plugin on wordpress.
The documentation says that to get the promo box to show up I need to add the following PHP to the template file:
<?php shopp('cart','promo-code'); ?>
I am new to the wordpress CMS and do not know which template file this this should be added to / where to look. If anyone has done this I would really appreciate the details of where to add this PHP to enable the feature. All the tutorials focus on creating the promotions in the cpanel but do not cover turning on the promo input box with PHP.
Thank you.
This is a Theme API tag that is usually added to the shopping cart template file. When custom templates are setup in your theme the file is located somewheres around wp-content/themes/yourtheme/shopp/cart.php. Note that yourtheme represents the directory name of your active WordPress theme files.
Shopp has starter templates built in that you can copy to your theme files. Editing the template files in the Shopp plugin is not recommended because you will lose your changes with each upgrade.
You can copy the files from Shopp to your theme yourself, or you can use the built-in system for copying them. More information about these templates and how to install them into your theme for customization can be found in the Shopp User Guide documentation in the Theme Templates article.

How to remove WooCommerce plugin dependency from Wootique theme?

How to remove WooCommerce plugin dependency from Wootique theme? When I activate Wootique theme and click on "visit site" in wordpress it shows a message "WooCommerce must be installed".
actually, You can't!
you must have to install "WooCommerce plugin", if you are using this Theme,
because the theme's source code is referring to WooCommerce plugin's functionality for displaying category wise products.
see here for details
hope this will help you
There should be a php if ( function_exists('woo-something') call in the functions.php file. Look into it, that's how wordpress themes check for installed products.
You may resolve it easily or may have to do some serious editing, I can't say since I don't have the theme.

Resources