Home / Admin / WPCode Functions
Duplicate Snippet

Embed Snippet on Your Site

WPCode Functions

For the WPCode plugin interface

Code Preview
php
<?php
// Skip show library screen
add_filter( 'wpcode_add_snippet_show_library', '__return_false' );
// Move status column 
add_filter( 'wpcode_code_snippets_table_columns', function ( $columns ) {
	if ( isset( $columns['status'] ) ) {
		$status = $columns['status'];
		unset( $columns['status'] );
		$columns = array_slice( $columns, 0, 1, true ) + array( 'status' => $status ) + array_slice( $columns, 1, count( $columns ) - 1, true );
	}
	return $columns;
} );
// Snippets per page
add_filter( 'wpcode_snippets_per_page', function() {
	return 25;
});
// Order Snippets 
add_filter( 'wpcode_code_snippets_table_prepare_items_args', function( $args ) {
	if ( ! isset( $_GET['orderby'] ) ) {
		$args['orderby'] = 'title';
	}
	if ( ! isset( $_GET['order'] ) ) {
		$args['order'] = 'ASC';
	}
	
	return $args;
});

Comments

Add a Comment