getMod('sf_impact_color_scheme');
$customStylesObj = new sf_impact_CurrentCustomColorScheme( $sf_impact_color_scheme );
$customStyles = $customStylesObj->getSchemeSettings();
load_theme_textdomain( 'sf-impact', get_template_directory() . '/languages' );
//Theme Actions
//Add the default menu
add_action('sf_impact_menu', 'sf_impact_default_menu');
//Add slideshow scripts if slideshow was selected
if ($sf_impact_Theme_Mods->getMod('sf_impact_home_header_type') == 1)
{
add_action('sf_impact_slideshow_scripts_action', 'sf_impact_default_slider_scripts', 5, 0);
add_action('sf_impact_slideshow', 'sf_impact_get_slideshow', 5, 3);
}
//Add action for featured highlights if featured highlights was selected
if ($sf_impact_Theme_Mods->getMod('sf_impact_home_featured_highlights'))
add_action('sf_impact_highlights', 'sf_impact_highlightboxes_default', 5, 0);
//If home posts selected set actions to query and display posts
if ($sf_impact_Theme_Mods->getMod('sf_impact_home_posts'))
{
add_action('sf_impact_home_query', 'sf_impact_default_home_query', 5, 0);
add_action('sf_impact_posts', 'sf_impact_default_posts', 5, 2);
}
add_action('sf_impact_header', 'sf_impact_default_header', 5, 5);
//add blog page template
add_filter( 'template_include', 'sf_impact_blog_template' ); //This will be called every time a template is loaded - I was wrong, it should always be called.
/*
* Overwrite page with blog template for thumbnail grid when no post category
*/
function sf_impact_blog_template( $template ) {
//check to see if this is the read more page for the thumbnail grid before executing anything.
global $post, $sf_impact_Theme_Mods;
$sf_impact_home_rp_categoryid = $sf_impact_Theme_Mods->getMod( 'sf_impact_home_rp_categoryid' );
$sf_impact_thumbnail_more_page = $sf_impact_Theme_Mods->getMod( 'sf_impact_thumbnail_more_page' );
//this conditional is the only thing that should be happening here.
if (is_page() && $post && $post->ID == $sf_impact_thumbnail_more_page && ($sf_impact_home_rp_categoryid == "0" || $sf_impact_home_rp_categoryid == ""))
{
//if it is, load the template
$template = get_template_directory() . '/inc/more-posts.php';
if( file_exists( $template ) ) {
return $template;
}
}
//moved settings out of here
return $template;
}
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'sf-impact' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'aside',
'chat',
'gallery',
'image',
'video',
'quote',
'link',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'sf_impact_custom_background_args', array(
'default-color' => $customStyles['background_color'],
'default-image' => '',
) ) );
//add excerpt support for posts
add_post_type_support( 'page', 'excerpt' );
//settings moved here
//Social settings
$social_sites = sf_impact_social_media_array();
$social_icons = sf_impact_social_icons_array();
// any inputs that aren't empty are stored in $active_sites array
$sf_impact_icon_size = $sf_impact_Theme_Mods->getMod( 'sf_impact_icon_size' );
for ($i=0; $i < count($social_sites); ++$i)
{
$social_site = $social_sites[$i];
if( strlen( $sf_impact_Theme_Mods->getMod( $social_site ) ) > 0 ) {
$active_sites[] = $social_site;
$links[] = $sf_impact_Theme_Mods->getMod( $social_site );
$icons[] = $social_icons[$i];
}
}
function sf_impact_customPostPages() {
if(isset($_POST['custom_action']) && $_POST['custom_action'] == true) {
if(isset($_POST['custom_color_scheme'])) {
$theme = new sf_impact_CurrentCustomcolorscheme($_POST['custom_color_scheme']);
die(json_encode($theme->getStylesheet()));
}
}
}
sf_impact_customPostPages();
}
endif; // sf_impact_setup
add_action( 'after_setup_theme', 'sf_impact_setup' );
/**
* Set the content width in pixels
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
if ( ! isset( $content_width ) ) {
$content_width = 640;
}
//Register suggested theme plugins
require_once dirname( __FILE__ ) . '/pluginauth/class-tgm-plugin-activation.php';
//TGMPA Suggested Plugins
add_action( 'tgmpa_register', 'sf_impact_plugins' );
if (!function_exists('sf_impact_plugins')):
/**
* Sugested plugins
*
* TGM Plugin Activation
*
*/
function sf_impact_plugins() {
/**
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
array(
'name' => 'Featured Image Thumbnail Grid',
'slug' => 'thumbnail-grid',
'required' => false,
),
);
$plugins = apply_filters('sf_impact_plugins', $plugins);
/**
* Array of configuration settings. Amend each line as needed.
* If you want the default strings to be available under your own theme domain,
* leave the strings uncommented.
* Some of the strings are added into a sprintf, so see the comments at the
* end of each line for what each argument will be.
*/
$config = array(
'default_path' => '', // Default absolute path to pre-packaged plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
'strings' => array(
'page_title' => __( 'Install Required Plugins', 'sf-impact' ),
'menu_title' => __( 'Install Plugins', 'sf-impact' ),
'installing' => __( 'Installing Plugin: %s', 'sf-impact' ), // %s = plugin name.
'oops' => __( 'Something went wrong with the plugin API.', 'sf-impact' ),
'notice_can_install_required' => __( 'This theme requires the following plugin: %1$s.', 'sf-impact' ), // %1$s = plugin name(s).
'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.' , 'sf-impact' ), // %1$s = plugin name(s).
'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' , 'sf-impact'), // %1$s = plugin name(s).
'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' , 'sf-impact'), // %1$s = plugin name(s).
'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'sf-impact'), // %1$s = plugin name(s).
'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.', 'sf-impact'), // %1$s = plugin name(s).
'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'sf-impact' ), // %1$s = plugin name(s).
'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.', 'sf-impact' ), // %1$s = plugin name(s).
'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'sf-impact'),
'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'sf-impact' ),
'return' => __( 'Return to Required Plugins Installer', 'sf-impact' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'sf-impact' ),
'complete' => __( 'All plugins installed and activated successfully. %s', 'sf-impact' ), // %s = dashboard link.
'nag_type' => 'updated' // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'.
)
);
tgmpa( $plugins, $config );
}
endif;
/**
* Register widget areas.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
if (!function_exists('sf_impact_widgets_init')):
function sf_impact_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'sf-impact' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '