Categories
Programming

WordPress – add_help_tab – add context help to custom admin plugin page

How to add context help to custom admin plugin page? Some time ago I had to put help content to custom admin plugin page for my project.

context_help

There are pretty good examples at wordpress.org . Here is one of those examples :

<?php 
add_action('admin_menu', 'my_admin_add_page');

function my_admin_add_page() {
    $my_admin_page = add_options_page(__('My Admin Page', 'map'), __('My Admin Page', 'map'), 'manage_options', 'map', 'my_admin_page');

    // Adds my_help_tab when my_admin_page loads
    add_action('load-'.$my_admin_page, 'my_admin_add_help_tab');
}

function my_admin_add_help_tab () {
    $screen = get_current_screen();

    // Add my_help_tab if current screen is My Admin Page
    $screen->add_help_tab( array(
        'id'	=> 'my_help_tab',
        'title'	=> __('My Help Tab'),
        'content'	=> '<p>' . __( 'Descriptive content that will show in My Help Tab-body goes here.' ) . '</p>',
    ) );
}
?>

This is working fine if you want to add context help to your custom option page within settings menu or to your custom post type. But if you have empty admin page then probably will nothing happened like in my case. Why is that?

Categories
Programming

How to add custom filed to customers table in OpenCart – Admin panel

How to add custom filed to customers table in OpenCart?

OpenCart has many flaws, at least in version <2. Unlike WordPress for example there is no easy way to change core functionality with custom plugin without changing the source code. There is no pub/sub architecture for interrupting system events…

But if you need to add custom fields to custumer, here is code simple example for that in five simple steps.

Step 1

Add form html in admin panel :


// admin/view/template/sale/customer_form.tpl
// find <input name="firstname" type="text" value="<?php echo $firstname; ?>" />
// and add before :
<input name="#field_name#" type="text" value="<?php echo #field_name#; ?>" />
Categories
Programming

Symfony2 : header won’t change in download controller

Sooner or late you have to add file download option to your symfony2 project. As many times before I have been created controller just for that. But something went wrong, file was interpreted as text by browser instead as file for download.

Categories
Programming

PHP : __FILE__ problem with symbolics links and file path

Some time ago I have organized my wordpress plugins via symbolic links. It’s helped me to keep all plugins inside one repository dir and eases me to deploy plugins in different test wordpress locations on my WAMP server. Example of that organization :


d:\plugins\plugin1 // real loaction
d:\plugins\plugin2 // real location
...
d:\www\wordpress\wp-content\plugins\plugin1 // symbolic link
d:\www\wordpress\wp-content\plugins\plugin2 // symbolic link
...