array( 'wordpress-seo/wp-seo.php', // Yoast SEO 'login-lockdown/loginlockdown.php', // Correct Hypens 'roi-security/roi-security.php', 'login-logo/login-logo.php', 'broken-link-checker/broken-link-checker.php', 'gravityforms/gravityforms.php', 'divi-builder/divi-builder.php' ), 'nay' => array( 'google-analyticator/google-analyticator.php', 'google-sitemap-generator/sitemap.php', 'attachments/index.php', 'roi-seo/roi_seo.php', 'all-in-one-event-calendar/all-in-one-event-calendar.php' ), ); $roistr['remove_menu_pg'] = array( //'plugins.php', 'widgets.php', 'tools.php', // need for BLC 'options-general.php' ); $roistr['remove_menu_spg'] = array( 'index.php' => 'my-sites.php', // 'options-general.php' => 'options-discussion.php', // 'options-general.php' => 'options-writing.php', // 'options-general.php' => 'options-reading.php', // 'options-general.php' => 'options-permalink.php', // 'options-general.php' => 'options-media.php', // 'options-general.php' => 'loginlockdown.php', // 'options-general.php' => 'attachments', // 'themes.php' => 'themes.php', // 'themes.php' => 'widgets.php', // 'tools.php' => 'tools.php' ); // general helper functions, shouldnt have to access during dev require_once('_/assistants.php'); // customizer api, additions for $roistr variables (contact, social, banner/slideshow) require_once('_/customizer.php'); /* function SearchFilter($query) { if ($query->is_search) $query->set('post_type', 'page'); } return $query; } add_filter('pre_get_posts','SearchFilter'); */ /* ===================================================================================================== WORDPRESS AND THEME SETTINGS /* ----------------------------------------------------------------------------------------------------- */ // wordpress overwrite width default settings $content_width = ''; //add_action('init', 'remove_comment_support', 100); // ADD WORDPRESS FEATURES add_theme_support( 'post-thumbnails' ,array('page' ) ); add_theme_support( 'html5',array('comment-list','comment-form','search-form','gallery','caption')); //add_theme_support( 'post-formats', array( 'gallery' ) ); //d_post_type_support( 'page', 'post-formats' ); add_post_type_support( 'page', 'excerpt' ); add_image_size('slideshow',$roistr['slideshow_w'],$roistr['slideshow_h'],true); // REGISTER WORDPRESS FEATURES //register_sidebars(2, array('name'=>'Foobar %d')); register_nav_menu( 'main-nav', 'Main Navigation' ); // SCRIPTS add_action( 'wp_enqueue_scripts', 'roistr_make_scripts' ); add_filter( 'wp_default_scripts', 'roistr_remove_jquery_migrate' ); // GRAVITY FORM EDITS add_filter("gform_confirmation_anchor", create_function("","return true;")); add_action('wp_print_styles', create_function("","wp_dequeue_style('gforms_css');")); // Main Modifyer add_filter('the_content','roistr_make_content',999); // Add browser name to body class add_filter('body_class','thematic_browser_class_names'); add_action('body_class','roistr_make_bodyclass'); // redirect to file if attachment add_action('wp','roistr_redirect_if_attachment'); // optionally disable search via $roistr['has_search'] boolean add_action( 'wp', 'roistr_disable_search', 5 ); // remove junk from header add_filter('post_comments_feed_link',create_function("","return false;") ); remove_action('wp_head', 'wp_generator'); remove_action( 'wp_head', 'feed_links_extra', 3 ); remove_action( 'wp_head', 'feed_links', 2 ); remove_action( 'wp_head', 'rsd_link' ); remove_action( 'wp_head', 'wlwmanifest_link' ); remove_action( 'wp_head', 'index_rel_link' ); remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); add_filter( 'disable_wpseo_json_ld_search', '__return_true' ); add_action( 'init', 'roistr_disable_emojis' ); // add shortcodes add_shortcode('space','roistr_shortcode_space'); add_shortcode('clear','roistr_shortcode_clear'); add_shortcode('box','roistr_shortcode_box'); add_shortcode('email','roistr_return_email'); add_shortcode('phone','roistr_phone'); add_shortcode('iframe','roistr_iframe'); add_shortcode('todo', 'roistr_todoshortcode' ); add_shortcode('TODO', 'roistr_todoshortcode' ); // admin: remove menu bar show_admin_bar( $roistr['has_admin_bar'] ); // admin: edit the admin menu, this isn't a control thing, it's a usability thing add_action( 'admin_menu', 'roistr_remove_from_admin_menu' ); // admin: edit the admin some more add_action('admin_head','roistr_modify_admin_header'); //add_action('admin_notices','roistr_plugin_check'); // admin: Add stylesheet to TinyMCE # add_filter( 'mce_css', 'roistr_tinymce_css' ); // admin: load customizer interface add_action( 'customize_register', 'roistr_customize_register' ); add_action( 'customize_controls_print_styles','roistr_customizer_hide_some_stuff'); // remove divi junk add_action('init','roistr_delete_project_post_type'); // Filters for WP-API version 1.x add_filter( 'json_enabled', '__return_false' ); add_filter( 'json_jsonp_enabled', '__return_false' ); // Filters for WP-API version 2.x add_filter( 'rest_enabled', '__return_false' ); add_filter( 'rest_jsonp_enabled', '__return_false' ); // Remove REST API info from head and headers remove_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' ); remove_action( 'wp_head', 'rest_output_link_wp_head', 10 ); remove_action( 'template_redirect', 'rest_output_link_header', 11 ); remove_action( 'wp_head', 'rest_output_link_wp_head' ); remove_action( 'wp_head', 'wp_oembed_add_discovery_links' ); remove_action( 'template_redirect', 'rest_output_link_header', 11, 0 ); /* ===================================================================================================== MAIN FUNCTIONS /* ----------------------------------------------------------------------------------------------------- */ /** * Enqueue scripts into WordPress * * Load in various styles and scripts into wordpress. Run conditionals to reduce unneeded scripts * * @since 3.0 * * @see `add_action( 'wp_enqueue_scripts'...` */ function roistr_make_scripts() { global $roistr; $version = ($roistr['dev']) ? time() : false; // force hard refresh on dev or version++ // google font (still have to manually add to style.less) if (isset($roistr['google_font']) && !empty($roistr['google_font'])) { wp_register_style('gfont', $roistr['google_font'], '', $version); wp_enqueue_style( 'gfont'); } if (!$roistr['dev']) { wp_register_style('main', get_template_directory_uri() . '/style.css', array(), '201802' ); wp_enqueue_style( 'main'); } // jQuery wp_enqueue_script( 'jquery'); // Theme wp_register_script('main', get_template_directory_uri() . '/_/js/main.js', array('jquery','aos'), '201802' ); wp_enqueue_script( 'main' ); // lightbox if ( has_post_format( 'gallery' ) ) { wp_register_script('lightbox', get_template_directory_uri() . '/_/js/jquery.lightbox.js', array('jquery'), $version, true); wp_enqueue_script( 'lightbox'); wp_register_style('lightbox', get_template_directory_uri() . '/_/js/jquery.lightbox.css', array('main'), $version, true); wp_enqueue_style( 'lightbox'); } // ON SCOLL ANIMATE // --------------------------------------------------- // https://github.com/michalsnik/aos // share.roimediaworks.ca/_jquery.aos.js && share.roimediaworks.ca/_jquery.aos.css // //
wp_register_style('aos', get_template_directory_uri() . '/_/js/jquery.aos.css'); wp_enqueue_style( 'aos'); wp_register_script('aos', get_template_directory_uri() . '/_/js/jquery.aos.js', array('jquery'), $version, true); wp_enqueue_script( 'aos'); // YOUTUBE BACKGROUND // --------------------------------------------------- // share.roimediaworks.ca/_jquery.youtubebackground.js // $('#youtube').YTPlayer({ // fitToBackground: true, // videoId: 'B-Wfdm5M-dM' // }); # wp_register_script('youtubebackground', get_template_directory_uri() . '/_/js/jquery.youtubebackground.js', array('jquery'), $version, true); # wp_enqueue_script( 'youtubebackground' ); // parallaxie // --------------------------------------------------- # wp_register_script('parallaxie', get_template_directory_uri() . '/_/js/jquery.parallaxie.js', array('jquery'), $version, true); # wp_enqueue_script( 'parallaxie' ); // WAYPOINTS // --------------------------------------------------- // share.roimediaworks.ca/_jquery.waypoints.js // var waypoints = $('section').waypoint({ // handler: function(direction) { alert() } // }) # wp_register_script('waypoints', get_template_directory_uri() . '/_/js/jquery.waypoints.js', array('jquery'), $version, true); # wp_enqueue_script( 'waypoints' ); } /** * Make vcard * * Creates a vcard using schema.org, pulls vars from Customizer -> Contact Details * * @since 1 * * @see _/customizer.php */ function roistr_make_card() { global $roistr; $return .= "
{$roistr[ {$roistr['name']}
"; if (!empty($roistr['streetaddress'])) $return .= "{$roistr['streetaddress']}"; $return .= "{$roistr['city']}, {$roistr['province']}"; if (!empty($roistr['postalcode'])) $return .= "{$roistr['postalcode']}"; $return .= "
Call: ".roistr_return_clean_phonenumber($roistr['phonenumber'])."
Email: "; if (!empty($roistr['fax'])) $return .= "{$roistr['fax']}"; $domaintext = str_replace( array('http://','https://','www.'),'',strtolower( rtrim(get_bloginfo('url'),"/") ) ); $return .= ""; if (!empty($roistr['latitude'])) $return .= "
"; if (!empty($roistr['has_search'])) $return .= '
'; $return .= roistr_make_social()."
"; return $return; } /** * Make Slideshow OR 'Featured Image' banner image(s) * * @since 1 * * @see `roistr_make_scripts` * @return string HTML of banner or not */ function roistr_make_banner() { global $roistr, $wpdb; $pg = (is_home()) ? get_option('page_for_posts') : get_the_ID(); $thispg = get_post($pg); $img = wp_get_attachment_image_src( get_post_thumbnail_id($thispg->ID), 'slideshow' ); if (isset($_GET['s']) || is_search() || is_404()) { echo "
"; return; } if ( (is_single() && isset($img[1])) || isset($img[1])) { echo " "; } // no featured image banner else { echo "
"; } } /** * Main modifier of the_content() output * * Default: add excerpt between title and content * Default: add an inline featured images (reaches beyond @width) * * @since 1 * * @see `functions.php` `add_action('the_content'...` * * @return string HTML $the_content with any conditional additions herin */ function roistr_make_content($the_content) { global $roistr; return $the_content; } /** * Make social links * * create social links from svg icons based on values entered into wp-admin customizer * * @since 2 * * @see `