Closed Pixelous closed 5 years ago
Hi,
the plugin page can be moved to another location with the help of a built in filter. Please read this FAQ item for more info: https://wordpress.org/plugins/one-click-demo-import/#how%20to%20change%20the%20location%2C%20title%20and%20other%20parameters%20of%20the%20plugin%20page%3F
Take care!
@capuderg I am sorry but looks we mean different things, by location you mean left WordPress menu panel and I mean theme directory so I can modify plugin-page.php to add my own HTML there.
Can you please assist?
Please check the plugin FAQ section, on how to modify the plugin page text and different things: https://wordpress.org/plugins/one-click-demo-import/#faq-header
There is no way to modify the whole plugin-page, if that is what you are asking.
Take care!
@capuderg yes I need access to the whole plugin-page.php to modify some html, not page title, etc. I want to remove import button if the buyer of my theme does not register it.
<?php $verified = get_option('theme_verify'); ?>
<?php if ( $verified == true ) { ?>
<button class="ocdi__gl-item-button button button-primary js-ocdi-gl-import-data" value="<?php echo esc_attr( $index ); ?>"><?php esc_html_e( 'Import', 'pt-ocdi' ); ?></button>
<?php } ?>
You sure you can not help?
What does this filter do apply_filters( 'pt-ocdi/plugin_page_display_callback_function', array( $this, 'display_plugin_page' ) )
?
I can not beleieve I can not modify such a little things. :(
You can replace the whole plugin page with that filter (forgot we have it :) ).
You can use it like this:
add_filter( 'pt-ocdi/plugin_page_display_callback_function', 'replace_ocdi_plugin_page_callback' );
function replace_ocdi_plugin_page_callback(){
// the returned string of the new HTML page has to go here.
}
Take care!
@capuderg can I use this:
add_filter( 'pt-ocdi/plugin_page_display_callback_function', 'replace_ocdi_plugin_page_callback' );
function replace_ocdi_plugin_page_callback(){
require_once( get_template_directory() . '/inc/one-click-demo-import/views/plugin-page.php' );
}
?
@capuderg if I use this:
add_filter( 'pt-ocdi/plugin_page_display_callback_function', 'replace_ocdi_plugin_page_callback' );
function replace_ocdi_plugin_page_callback(){
require_once( get_template_directory() . '/inc/one-click-demo-import/views/plugin-page.php' );
}
then I have this error
Fatal error: Uncaught Error: Using $this when not in object context in /inc/one-click-demo-import/views/plugin-page.php.
Maybe you need to to replace $this
with $ocdi
and initialize it at the top of the page $ocdi = OCDI\OneClickDemoImport::get_instance();
Hi, @capuderg When I use the above code then I facing this issue.
Can you help to fix this issue its urgent.
[07-Sep-2020 02:25:12 UTC] PHP Fatal error: Uncaught Error: Cannot access private property OCDI\OneClickDemoImport::$plugin_page_setup in D:\xampp\htdocs\testing\wp-content\themes\twentytwenty\template-parts\import.php:71 Stack trace:
Hi @naeem7896,
if you are overwriting the whole plugin page, then just remove the calls to ->plugin_page_setup
. It's only used in the "import mode" URL generation, so you can change the URL to your specific admin OCDI import page URL.
Take care!
Hi @capuderg, I have already use this but my demos are multiple so I have created this snippet and also its working now. Can you check this code and share the idea Can i other way to use this. https://gist.github.com/naeem7896/4419e1bbe8a9736ff6a3ecb84c83fa42
Hi @naeem7896,
all that matters is that it works OK for you. But I don't see any important code changes in the copied code (admin_enqueue_scripts and admin_menu actions), so you could also just use this code here:
add_filter( 'pt-ocdi/plugin_page_display_callback_function', 'replace_ocdi_plugin_page_callback' ); function replace_ocdi_plugin_page_callback(){ require_once( get_template_directory() . '/inc/one-click-demo-import/views/plugin-page.php' ); }
And just change the content of the required plugin-page.php "view" file.
Take care!
Hi @capuderg, Thanks for sharing this code, I have already test this code but every time I am getting this error. https://imgur.com/a/5u2UArs
For this issue I have created a new code.
Hi,
trying to include plugin-page.php in my theme using
but have this error:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'OCDI\OneClickDemoImport' does not have a method 'my_textdomain_display_plugin_page' in ../wp-includes/class-wp-hook.php on line 286
Cannot load pt-one-click-demo-import.
Can you please help?