Skip to content

Commit

Permalink
Add support for sort by type in GP 2.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
toolstack committed Jul 5, 2016
1 parent 9f784c3 commit 45e0f12
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gp-srt.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@

// Add an action to WordPress's init hook to setup the plugin. Don't just setup the plugin here as the GlotPress plugin may not have loaded yet.
add_action( 'gp_init', 'gp_srt_init' );
add_filter( 'gp_sort_by_fields', 'gp_srt_sort_by_fields' );

// This function creates the plugin.
function gp_srt_init() {
include( dirname( __FILE__ ) . '/format_srt.php' );
}

function gp_srt_sort_by_fields( $sort_fields ) {
$sort_fields['context'] = array(
'title' => __( 'Context', 'glotpress' ),
'sql_sort_by' => 'o.context %s',
);

return $sort_fields;
}

0 comments on commit 45e0f12

Please sign in to comment.