diff --git a/sandbox-adaptions/admin/style.css b/sandbox-adaptions/admin/style.css index 78ed8ce..df875aa 100644 --- a/sandbox-adaptions/admin/style.css +++ b/sandbox-adaptions/admin/style.css @@ -13,12 +13,26 @@ padding-left:12px; padding-right:12px; } -#postbox-container-2 .jcf_edit_field{ - width:50%; +@media screen and (min-width:767px){ + #postbox-container-2 .jcf_edit_field{ + width:50%; + } +} +@media screen and (max-width:1500px){ + #postbox-container-2 .jcf_edit_field.field_textarea, + #postbox-container-2 .jcf_edit_field.field_table{ + width:100%; + } +} +#postbox-container-2 .jcf_edit_field .jcf_edit_field{ + width:100%; } #jcf_fieldset-masse .jcf_edit_field{ width:33%; } +#jcf_fieldset-newsdata .jcf_edit_field{ + width:100%; +} .jcf-get-shortcode{ margin-right:0; } diff --git a/sandbox-adaptions/sandbox-adaptions.php b/sandbox-adaptions/sandbox-adaptions.php index ec7d999..5f1d93a 100644 --- a/sandbox-adaptions/sandbox-adaptions.php +++ b/sandbox-adaptions/sandbox-adaptions.php @@ -48,14 +48,39 @@ function sandbox_setup_site() { // init custom widgets add_action('widgets_init', 'sandbox_widgets_init'); + // disable emoji support for more pagespeed add_action('init', 'sandbox_disable_emojis'); + // remove unused default taxonomies + add_action('init', 'sandbox_unregister_taxonomies'); // load admin styles add_action('admin_head', 'sandbox_admin_styles_load'); + // remove WLW + // https://wphacks.wordpress.com/2008/08/27/wordpress-tip-remove-wlw-rsd-link/ + remove_action('wp_head', 'wlwmanifest_link'); + + // remove xml-rpc edit link + remove_action('wp_head', 'rsd_link'); + + // Remove generator info + // https://bhoover.com/remove-unnecessary-code-from-your-wordpress-blog-header/ + remove_action('wp_head', 'wp_generator'); + + // remove wp-sitemap.xml when using a xml sitemap plugin + add_filter('wp_sitemaps_enabled', '__return_false'); + // quick fix for https://wordpress.org/support/topic/jqeuery-error-live-is-not-a-function/ add_action('admin_enqueue_scripts', 'sandbox_jcf_admin_fix'); + // add a position field to user profile + // add_action( 'show_user_profile', 'sandbox_user_profile' ); + // add_action( 'edit_user_profile', 'sandbox_user_profile' ); + + // save/update position user profile field + // add_action( 'personal_options_update', 'sandbox_save_user_profile' ); + // add_action( 'edit_user_profile_update', 'sandbox_save_user_profile' ); + if ( !is_admin() ) { // add usefull classNames add_filter('body_class', 'sandbox_body_class'); @@ -77,6 +102,9 @@ function sandbox_setup_site() { // remove lazy block wrapper container markup in frontend add_filter( 'lzb/block_render/allow_wrapper', '__return_false' ); + // custom archive query settings + add_action( 'pre_get_posts', 'sandbox_archive_query'); + // Admin pages related stuff } else { // add usefull classNames @@ -84,6 +112,11 @@ function sandbox_setup_site() { } // plugin integrations + + // lazy block Handlebars helper + add_action('lzb_handlebars_object', 'sandbox_lazyblock_handlebars_helper'); + + // listo order for cf7 select input add_filter('wpcf7_form_tag_data_option', 'sandbox_listo_ordered', 11, 1); // listo uses an iso3 country list // country iso2 to iso3: @@ -91,16 +124,21 @@ function sandbox_setup_site() { // all countries and phone-codes (iso2): // https://github.com/ChromaticHQ/intl-tel-input/blob/master/src/js/data.js + // handle required attribute + add_filter('wpcf7_form_elements', 'sandbox_wpcf7_form_elements'); + // filter values of form tags to email add_filter( 'cf7sg_mailtag_email-updates', 'sandbox_cf7_mailtag_email_updates', 10, 3); // remove layout from "cf7 smart grid plugin" - add_action('smart_grid_register_styles', 'sandbox_smart_grid_register_styles'); - + // add_action('smart_grid_register_styles', 'sandbox_smart_grid_register_styles'); // use really simple captcha in contact form 7 // add_filter('wpcf7_use_really_simple_captcha', '__return_true'); + // CF7 gated content with custom field + add_filter('do_shortcode_tag', 'sandbox_cf7_gated_content', 10, 3); + } // Check if function "wp_body_open" exits, if not create it @@ -121,28 +159,75 @@ function sandbox_image_sizes() { } } -// custom image sizes settings +/** + * custom image sizes settings + * + * @see https://en.wikipedia.org/wiki/16:9_aspect_ratio + */ function sandbox_get_image_sizes() { $sizes = array(); - $crop = true; - $ratio = '16_9'; - $ratio_opts = explode("_", $ratio); - // Standard (with sidebar) - $width = 805; - $height = absint($width*$ratio_opts[1]/$ratio_opts[0]); - $sizes['sandbox-default'] = array('title' => __('Standard (with sidebar)', 'sandbox'), 'args' => array('w' => $width, 'h' => $height, 'crop' => $crop)); - //Full width (no sidebar) - $width = 1090; - $height = absint($width*$ratio_opts[1]/$ratio_opts[0]); - $sizes['sandbox-wide'] = array('title' => __('Full Width (no sidebar)', 'sandbox'), 'args' => array('w' => $width, 'h' => $height, 'crop' => $crop)); + // larger thumbnail + $sizes['thumbnail-semi-large'] = array( + 'title' => __('Thumbnail-Semi-Large', 'sandbox'), + 'args' => array( + 'w' => 640, + 'h' => 640, + 'crop' => true, + ), + ); + + // Standard (with sidebar) 16:9 + $sizes['sandbox-default'] = array( + 'title' => __('Standard (with sidebar)', 'sandbox'), + 'args' => array( + 'w' => 800, + 'h' => 450, + 'crop' => true, + ), + ); + + //Full width (no sidebar) 16:9 + $sizes['sandbox-wide'] = array( + 'title' => __('Full Width (no sidebar)', 'sandbox'), + 'args' => array( + 'w' => 1280, + 'h' => 720, + 'crop' => true, + ), + ); - //Hero image - $width = 1920; - $height = absint($width*$ratio_opts[1]/$ratio_opts[0]); - $sizes['sandbox-hero'] = array('title' => __('Hero image', 'sandbox'), 'args' => array('w' => $width, 'h' => $height, 'crop' => $crop)); + // Hero image 16:9 + $sizes['sandbox-hero'] = array( + 'title' => __('Hero image', 'sandbox'), + 'args' => array( + 'w' => 1920, + 'h' => 1080, + 'crop' => true, + ), + ); + + // Hero image 16:9 + $sizes['blog-hero'] = array( + 'title' => __('Hero image', 'sandbox'), + 'args' => array( + 'w' => 1500, + 'h' => 476, + 'crop' => true, + ), + ); + + // keep aspect ratio + $sizes['semi-large'] = array( + 'title' => __('Semi-Large', 'sandbox'), + 'args' => array( + 'w' => 640, + 'h' => 640, + 'crop' => false, + ), + ); return $sizes; } @@ -165,7 +250,7 @@ function sandbox_login_enqueue_scripts(){ } // init custom widgets -function sandbox_widgets_init(){; +function sandbox_widgets_init(){ register_widget('sandbox_faq_nav_widget'); // register_widget('sandbox_events_widget'); // register_widget('sandbox_social_widget'); @@ -218,6 +303,11 @@ function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) { return $urls; } +// remove unused default taxonomies +function sandbox_unregister_taxonomies(){ + register_taxonomy('category', array(), array('show_in_nav_menus' => false)); +} + // adds usefull body classNames // @param $classes array function sandbox_body_class($classes){ @@ -282,6 +372,39 @@ function sandbox_jcf_admin_fix(){ } } +// add a position field to user profile +function sandbox_user_profile($user) { ?> +
+ |
+ + Please enter position at your organisation. + |
+
---|---|
+ |
+ + Please enter your LinkedIn username. + |
+