Monday, May 23rd, 2016
Paste this in to your functions.php file – this assumes your CPT is called ‘products’
add_filter( 'posts_search_orderby', function( $search_orderby ) {
global $wpdb;
return "{$wpdb->posts}.post_type LIKE 'products' DESC, {$search_orderby}";
});
Tags: CPT, Custom post type, Posts, Results, Search, WordPress
Posted in PHP, WordPress | No Comments »
Saturday, May 21st, 2016
Using the below code in your functions.php file, you would then only be able to access the WP dashboard by navigating to domain.com/wp-login.php?admin=access.
// Hiding wp-admin and wp-login.php
function protection_for_login_page() {
$QS = '?admin=access';
$theRequest = 'http://' . $_SERVER['SERVER_NAME'] . '/' . 'wp-login.php' . '?'. $_SERVER['QUERY_STRING'];
if ( site_url('/wp-login.php').$QS == $theRequest ) {
echo 'Query string matches';
} else {
header( 'Location: http://' . $_SERVER['SERVER_NAME'] . '/' );
}
}
add_action('login_head', 'protection_for_login_page');
Tags: Dashboard, Hide, Login page, WordPress, WP, wp-admin, wp-login
Posted in PHP, WordPress | No Comments »
Friday, May 20th, 2016
Add to functions.php
function cc_mime_types( $mimes ){
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );
Tags: Media support, PHP, SVG, WordPress
Posted in PHP, WordPress | No Comments »