Support » Plugin: File Away » Can Bulk Action Mode default to Enabled? Can the "File Away" btn be relabeled?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author thomstark

    (@thomstark)

    You not nerfherder. You scoundrel.

    These aren’t features but you can make it work with a little jQuery.

    Do you know how to create your own javascript file and enqueue it to the page? Here’s the javascript you would need:

    jQuery(document).ready(function($){
        $('span.ssfa-bulk-action-engage').text('Label Here');
        setTimeout(function(){
            $('a[id^="ssfa-bulk-action-toggle-"]').trigger('click');
        }, 500);
    });

    Where it says “Label Here” is where you type the label you want to replace the “File Away” text on the action button. The other thing will trigger a click on the “Enabled/Disabled” toggle link after 500 milliseconds (1/2 a second). You can change that to 0 or any number of milliseconds you like.

    Here’s how to enqueue the javascript to the page.

    1. Save the above script to a new file called: ‘custom-file-away.js’.
    2. Upload ‘custom-file-away.js’ to your theme’s primary directory (e.g., wp-content/themes/yourtheme)
    3. Add the following to your theme’s functions.php:

    class my_custom_scripts
    {
    	public function __construct()
    	{
    		add_action('wp_enqueue_scripts', array($this, 'scripts'));
    	}
    	public function scripts()
    	{
    		$pages = array('page-slug1','page-slug2','page-slug3',);
    		if(!is_admin() && is_page($pages))
    		{
    			wp_register_script('custom-file-away', (get_bloginfo('template_url').'/custom-file-away.js'), array('jquery'));
    			wp_enqueue_script('custom-file-away.js');
    		}
    	}
    }
    new my_custom_scripts;

    Change this line:

    $pages = array('page-slug1','page-slug2','page-slug3',);

    to reflect the page slugs, or the page IDs, of the pages where you have your File Away tables, and thus your javascript will only load up on those specific pages.

    Plugin Author thomstark

    (@thomstark)

    Oops. Typo in the php section. Replace:

    wp_enqueue_script(‘custom-file-away.js’);

    with:

    wp_enqueue_script(‘custom-file-away’);

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can Bulk Action Mode default to Enabled? Can the "File Away" btn be relabeled?’ is closed to new replies.