esc_html__( 'Main Navigation', 'toppic' ), // MAIN MENU
'footer-menu' => esc_html__( 'Footer Navigation', 'toppic' ), // FOOTER MENU
) );
/* ADD DEFAULT POSTS AND COMMENTS RSS FEED LINKS TO HEAD */
add_theme_support('automatic-feed-links' );
}
add_action('after_setup_theme', 'toppic_setup');
/*-----------------------------------------------------------------------------------*/
/* CURRENT THEME VERSION
/*-----------------------------------------------------------------------------------*/
if ( ! defined( 'KKFW_VERSION' ) ) {
define( 'KKFW_VERSION', '2.7' );
}
/*-----------------------------------------------------------------------------------*/
/* CHECK IF META PLUGIN INSTALLED
/*-----------------------------------------------------------------------------------*/
if ( !function_exists('rwmb_meta') ) {
function rwmb_meta() {
return false;
}
} else {
function kktfwp_meta_style() {
wp_enqueue_style( 'kktfwp-meta-style', get_theme_file_uri( '/css/meta-style.css' ), '', KKFW_VERSION );
}
add_action('admin_enqueue_scripts', 'kktfwp_meta_style');
}
/*-----------------------------------------------------------------------------------*/
/* REQUIRED PLUGINS
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'kk_register_required_plugins' ) ) {
function kk_register_required_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' => esc_html__( 'Like This', 'toppic' ), // The plugin name
'slug' => 'roses-like-this', // The plugin slug (typically the folder name)
'source' => get_template_directory() . '/includes/plugins/roses-like-this.zip',
'required' => false, // The plugin source
'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
'external_url' => '' // If set, overrides default API URL and points to an external URL
),
array(
'name' => esc_html__( 'Gallery Meta Boxes', 'toppic' ), // The plugin name
'slug' => 'meta-box', // The plugin slug (typically the folder name)
'source' => get_template_directory() . '/includes/plugins/meta-box.zip',
'required' => true, // The plugin source
'version' => '16.0', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
'external_url' => '' // If set, overrides default API URL and points to an external URL
),
array(
'name' => esc_html__( 'Visual Composer', 'toppic' ), // The plugin name
'slug' => 'js_composer', // The plugin slug (typically the folder name)
'source' => get_template_directory() . '/includes/plugins/js_composer.zip', // The plugin source
'required' => false, // If false, the plugin is only 'recommended' instead of required
'version' => '5.6', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
'external_url' => '' // If set, overrides default API URL and points to an external URL
),
array(
'name' => esc_html__( 'Kotofey Custom Post Types', 'toppic' ), // The plugin name
'slug' => 'kk-cpt', // The plugin slug (typically the folder name)
'source' => get_template_directory() . '/includes/plugins/kk-cpt.zip', // The plugin source
'required' => true, // If false, the plugin is only 'recommended' instead of required
'version' => '1.2', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
'external_url' => '' // If set, overrides default API URL and points to an external URL
),
array(
'name' => esc_html__( 'Contact From 7', 'toppic' ), // The plugin name
'slug' => 'contact-form-7', // The plugin slug (typically the folder name)
'required' => false, // If false, the plugin is only 'recommended' instead of required
'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
),
array(
'name' => esc_html__( 'One Click Demo Import', 'toppic' ), // The plugin name
'slug' => 'one-click-demo-import', // The plugin slug (typically the folder name)
'required' => false, // If false, the plugin is only 'recommended' instead of required
'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
)
);
/**
* 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(
'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA.
'domain' => 'KK_TF',
'default_path' => '', // Default absolute path to pre-packaged plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'has_notices' => true, // Show admin notices or not.
'dismissable' => false, // 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' => true, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
'strings' => array(
'page_title' => __( 'Install Required Plugins', 'tgmpa' ),
'menu_title' => __( 'Install Plugins', 'tgmpa' ),
'installing' => __( 'Installing Plugin: %s', 'tgmpa' ), // %s = plugin name.
'oops' => __( 'Something went wrong with the plugin API.', 'tgmpa' ),
'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.', 'tgmpa' ), // %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.', 'tgmpa' ), // %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.', 'tgmpa' ), // %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.', 'tgmpa' ), // %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.', 'tgmpa' ), // %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.', 'tgmpa' ), // %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.', 'tgmpa' ), // %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.', 'tgmpa' ), // %1$s = plugin name(s).
'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'tgmpa' ),
'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'tgmpa' ),
'return' => __( 'Return to Required Plugins Installer', 'tgmpa' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'tgmpa' ),
'complete' => __( 'All plugins installed and activated successfully. %s', 'tgmpa' ), // %s = dashboard link.
'nag_type' => 'updated' // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'.
)
);
tgmpa( $plugins, $config );
}
}
add_action( 'tgmpa_register', 'kk_register_required_plugins' );
/*-----------------------------------------------------------------------------------*/
/* VC SETUP
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'kk_vcSetAsTheme' ) ) {
function kk_vcSetAsTheme() {
vc_set_as_theme( $disable_updater = true );
require_once get_theme_file_path( '/includes/vc-func.php' );
}
}
add_action( 'vc_before_init', 'kk_vcSetAsTheme' );
add_action('admin_init', function()
{
if(is_admin()) {
setcookie('vchideactivationmsg', '1', strtotime('+3 years'), '/');
setcookie('vchideactivationmsg_vc11', (defined('WPB_VC_VERSION') ? WPB_VC_VERSION : '1'), strtotime('+3 years'), '/');
}
});
/*-----------------------------------------------------------------------------------*/
/* POSTS ID HELPER
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'kk_postid' ) ) {
function kk_postid() {
if (is_home() || is_search() || is_category() || is_tag() || is_date() || is_author() || is_404()) {
$postid = get_option( 'page_for_posts' );
} else if ( is_tax( 'portfolio-type' )) {
$postid = portfolioID();
} else if ( is_tax( 'gallery-type' )) {
$postid = galleryID();
} else if ( function_exists('is_shop') && is_shop() ) {
$postid = get_option( 'woocommerce_shop_page_id' );
} else {
$postid = get_the_ID();
}
return $postid;
}
}
/*-----------------------------------------------------------------------------------*/
/* REGISTERING SIDEBARS
/*-----------------------------------------------------------------------------------*/
function toppic_widgets_init() {
$sbopts=array(
'before_widget'=>'
',
'after_widget'=>'
',
'before_title'=>''
);
// BLOG SIDEBAR
register_sidebar(
array_merge($sbopts,
array(
'name'=>'Blog Sidebar',
'id'=>'kk-blog-sidebar',
'description'=>__( 'Add widgets here to appear in your blog sidebar.', 'toppic' ),
)
)
);
// PAGE SIDEBAR
register_sidebar(
array_merge($sbopts,
array(
'name'=>'Page Sidebar',
'id'=>'kk-page-sidebar',
'description'=>__( 'Add widgets here to appear in your page sidebar.', 'toppic' ),
)
)
);
// PORTFOLIO SIDEBAR
register_sidebar(
array_merge($sbopts,
array(
'name'=>'Portfolio Sidebar',
'id'=>'kk-portfolio-sidebar',
'description'=>__( 'Add widgets here to appear in your portfolio sidebar.', 'toppic' ),
)
)
);
}
add_action('widgets_init', 'toppic_widgets_init');
/*-----------------------------------------------------------------------------------*/
/* ENQUEUE SCRIPTS AND STYLES
/*-----------------------------------------------------------------------------------*/
function kk_get_jquery() {
$postid = kk_postid();
$bg_post_meta = get_post_meta($postid, '_custom_bg_type_value', true);
if( empty( $bg_post_meta ) ) {
$bg_post_meta = 'Default';
}
/* Stylesheets */
wp_enqueue_style( 'kk-icons', get_theme_file_uri( '/css/fontello.css' ), '', KKFW_VERSION );
wp_enqueue_style( 'kk-reset', get_theme_file_uri( '/css/reset.css' ), '', KKFW_VERSION );
wp_enqueue_style( 'kk-default', get_theme_file_uri( '/css/default.css' ), '', KKFW_VERSION );
wp_enqueue_style( 'style', get_stylesheet_uri(), array(), KKFW_VERSION );
wp_enqueue_style( 'kk-royalslider', get_theme_file_uri( '/css/royalslider.css' ), '', KKFW_VERSION );
wp_enqueue_style( 'kk-royalslider-skin', get_theme_file_uri( '/css/rs-default.css' ), '', KKFW_VERSION );
wp_enqueue_style( 'kk-lightbox', get_theme_file_uri( '/css/lightbox.css' ), '', KKFW_VERSION );
wp_enqueue_style( 'kk-woocommerce', get_theme_file_uri( '/css/woocommerce.css' ), '', KKFW_VERSION );
/**
* Enqueue Google Fonts.
*/
wp_enqueue_style( 'kk-gfonts', '//fonts.googleapis.com/css?family=Montserrat:400,700|Open+Sans:300,400,600&subset=latin,latin-ext', '', KKFW_VERSION);
if (get_option('toppic_theme_con_res') == 'true') {
wp_enqueue_style( 'kk-responsive', get_theme_file_uri( '/css/responsive.css' ), '', KKFW_VERSION);
}
/* Scripts */
wp_enqueue_script( 'kk-plugins', get_theme_file_uri( '/js/jquery.plugins.js' ), array( 'jquery' ), KKFW_VERSION, true );
wp_enqueue_script( 'kk-custom', get_theme_file_uri( '/js/jquery.custom.js' ), array( 'jquery' ), '1.8', true );
wp_enqueue_script( 'kk-modernizr', get_theme_file_uri( '/js/jquery.modernizr.custom.js' ), array( 'jquery' ), KKFW_VERSION, true );
if ( in_array( get_option( 'toppic_theme_menu_style' ), array( 'kk-menu-slide-right', 'kk-menu-fullscreen' ) ) ) {
wp_enqueue_script( 'kk-bg-check', get_theme_file_uri( '/js/jquery.background-check.min.js' ), array( 'jquery' ), KKFW_VERSION, true );
wp_enqueue_script( 'kk-classie', get_theme_file_uri( '/js/jquery.classie.js' ), array( 'jquery' ), KKFW_VERSION, true );
wp_enqueue_script( 'kk-menu', get_theme_file_uri( '/js/jquery.dlmenu.js' ), array( 'jquery' ), KKFW_VERSION, true );
}
/* Remove Visual Composer prettyPhoto lightbox */
wp_deregister_script( 'prettyphoto' );
/* Move an array to jQuery */
KkGetOptions::init();
$kk_data = KkGetOptions::TplConditions();
wp_localize_script( 'kk-custom', 'kk_js_data', $kk_data );
if ( rwmb_meta( 'kk_slider_auto' ) ) {
$postSliderData = array();
$postSliderData['state'] = rwmb_meta( 'kk_slider_auto' );
$postSliderData['delay'] = rwmb_meta( 'kk_sliderDelay' );
wp_localize_script( 'kk-custom', 'kk_postSlider', $postSliderData );
}
if ( post_password_required() && has_post_thumbnail() ) {
$passImg = wp_get_attachment_image_src(get_post_thumbnail_id(kk_postid()), 'featured-image-thumb');
wp_localize_script( 'kk-custom', 'kk_js_passImg', esc_url( $passImg[0] ) );
}
if (!is_admin()){
if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1))
wp_enqueue_script( 'comment-reply' );
}
if ( ( $bg_post_meta == 'Video' ) && ( get_post_meta( $postid, '_gallery_layout_value', true ) != 'Fullscreen') && ( get_post_meta( $postid, '_gallery_layout_value', true) != 'Fullscreen-Grid' ) ) {
if ( (get_option('toppic_theme_content_style') === 'kk-boxed' ) || (is_page_template('template-homepage-slider.php'))) {
$kkCheckBg = esc_url( get_post_meta($postid, '_bg_video_value', true) );
if (strpos($kkCheckBg, 'youtube') > 0) {
wp_enqueue_script('kk-bgvideo', get_theme_file_uri( '/js/jquery.bgVideo.js' ), array( 'jquery' ), KKFW_VERSION, true);
}
}
}
if ((( $bg_post_meta === 'Default' ) || ( $bg_post_meta === 'Custom Slideshow')) && ( get_post_meta($postid, '_gallery_layout_value', true) !== 'Fullscreen' ) && (get_post_meta($postid, '_gallery_layout_value', true ) !== 'Fullscreen-Grid' )) {
if ( get_option('toppic_theme_fullscreen_stream') === 'kk_royal' ) {
wp_enqueue_script('kk-royalslider', get_theme_file_uri( '/js/jquery.royalslider.min.js' ), array( 'jquery' ), KKFW_VERSION, true);
} else {
wp_enqueue_script('kk-kenb', get_theme_file_uri( '/js/jquery.kenb.js' ), array( 'jquery' ), KKFW_VERSION, true);
}
} else if ( get_post_meta($postid, '_gallery_layout_value', true) == 'Fullscreen' ) {
wp_enqueue_script('kk-royalslider', get_theme_file_uri( '/js/jquery.royalslider.min.js' ), array( 'jquery' ), KKFW_VERSION, true);
}
if( is_home() || is_front_page() || is_archive() || is_search() || has_post_format('gallery') || is_singular('portfolio') || is_page_template('template-home-demo.php') || is_page_template('template-home-demo-2.php') ) {
if(!is_page_template('template-homepage-slider.php')) {
wp_enqueue_script('kk-royalslider', get_theme_file_uri( '/js/jquery.royalslider.min.js' ), array( 'jquery' ), KKFW_VERSION, true);
}
}
if ( is_page_template('template-portfolio.php') || is_page_template('template-gallery.php') || is_tax( 'portfolio-type' ) || is_tax( 'gallery-type' ) ) {
wp_enqueue_script('kk-mixitup', get_theme_file_uri( '/js/jquery.mixitup.min.js' ), array( 'jquery' ), KKFW_VERSION, true);
}
if ( is_page_template('template-homepage-grid.php') || in_array( get_post_meta($postid, '_gallery_layout_value', true), array( '2-column', '3-column', '4-column', 'Thumbnails' ) ) && get_post_meta($postid, '_is_masonry_value', true) === 'Yes' || get_post_meta($postid, '_gallery_layout_value', true) == 'Mosaic' || get_post_meta($postid, '_gallery_layout_value', true) == 'Fullscreen-Grid' && get_post_meta($postid, '_grid_type_value', true) == 'Random' ) {
wp_enqueue_script('masonry');
}
if(get_post_meta($postid, '_gallery_layout_value', true) !== 'Fullscreen' && !is_page_template('template-homepage.php')) {
wp_enqueue_script('kk-lightbox', get_theme_file_uri( '/js/jquery.lightbox.js' ), array( 'jquery' ), KKFW_VERSION, true);
}
}
add_action('wp_enqueue_scripts', 'kk_get_jquery');
/*-----------------------------------------------------------------------------------*/
/* HELLO MESSAGE
/*-----------------------------------------------------------------------------------*/
if( ! function_exists( 'siteoptions_admin_head' ) ) {
function siteoptions_admin_head() { ?>
0) {
parse_str( parse_url( esc_url( $bgUrl ), PHP_URL_QUERY ), $array );
$kk_data['video_source'] = $array['v'];
$kk_data['helper'] = true;
} else {
$kk_data['video_source'] = esc_url( $bgUrl );
}
$kk_data['fallback_img'] = esc_url( $fallbackImg );
wp_localize_script( 'kk-custom', 'kk_js_video', $kk_data );
}
}
}
/*-----------------------------------------------------------------------------------*/
/* PHOTO PROOFING AJAX HANDLER
/*-----------------------------------------------------------------------------------*/
add_action( 'wp_ajax_nopriv_kk_proofing', 'kk_proofing' );
add_action( 'wp_ajax_kk_proofing', 'kk_proofing' );
if ( !function_exists( 'kk_proofing' ) ) {
function kk_proofing() {
check_ajax_referer( 'proof-nonce', '_wpnonce' );
$data = wp_get_attachment_metadata( $_POST['image_id'] );
if ( isset($data['image_meta']['proof_status'] ) && $data['image_meta']['proof_status'] === 'checked' ) {
$data['image_meta']['proof_status'] = 'unchecked';
} else {
$data['image_meta']['proof_status'] = 'checked';
}
wp_update_attachment_metadata( $_POST['image_id'], $data );
$new_status = wp_get_attachment_metadata( $_POST['image_id'] );
wp_send_json_success( $new_status['image_meta']['proof_status'] );
}
}
/*-----------------------------------------------------------------------------------*/
/* FULLSCREEN GALLERY
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'galleryFS' ) ) {
function galleryFS() {
$postid = get_the_ID();
$attachments = rwmb_meta( 'kk_imgadv', 'type=image_advanced', $post_id = $postid );
echo '';
if (get_post_meta($postid, '_full_style_value', true) == 'Fade') {
$kk_galleryFS = 'fade';
} else if (get_post_meta($postid, '_full_style_value', true) == 'Move') {
$kk_galleryFS = 'move';
} else {
$kk_galleryFS = get_option("toppic_theme_gallery_fullscreen_effect");
}
if (get_post_meta($postid, '_scale_mode_value', true) === 'Fill') {
$kk_galleryScale = 'fill';
} else if (get_post_meta($postid, '_scale_mode_value', true) === 'Fit') {
$kk_galleryScale = 'fit';
}
if (get_post_meta($postid, '_near_by_value', true) === 'Yes') {
$kk_near_by = 1;
} else {
$kk_near_by = 0;
}
if (get_option("toppic_theme_gallery_fullscreen_loop") === 'true') {
$kk_loop = 1;
} else {
$kk_loop = 0;
}
if (get_option("toppic_theme_gallery_fullscreen_autoplay") === 'true') {
$kk_autoplay = 1;
} else {
$kk_autoplay = 0;
}
// Built an array for slider
$kk_data = array();
$kk_data['menuStyle'] = get_option('toppic_theme_menu_style');
$kk_data['transitionType'] = $kk_galleryFS;
$kk_data['galleryScale'] = $kk_galleryScale;
$kk_data['visibleNearBy'] = $kk_near_by;
$kk_data['galleryLoop'] = $kk_loop;
$kk_data['transitionSpeed'] = get_option("toppic_theme_gallery_fullscreen_transition");
$kk_data['autoplay'] = array(
'enabled' => $kk_autoplay,
'delay' => get_option("toppic_theme_gallery_fullscreen_delay"),
);
$kk_data['slides'] = array_merge($attachments);
// Move an array to jQuery
if (!empty($attachments)) {
wp_localize_script( 'kk-custom', 'kk_js_gallery', $kk_data );
}
}
}
/*-----------------------------------------------------------------------------------*/
/* BACKGROUND SLIDESHOW
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'bgSlideshow' ) ) {
function bgSlideshow() {
// Check layout style. Enable slideshow if style 'Boxed' or it's a frontpage
if ( (get_option('toppic_theme_content_style') === 'kk-boxed' ) || (is_page_template('template-homepage-slider.php'))) {
if ( get_option('toppic_theme_fullscreen_stream') === 'kk_royal' ) {
slideshowType_1();
} elseif( get_option('toppic_theme_fullscreen_stream') === 'ken_b') {
slideshowType_2();
}
}
}
}
if ( ! function_exists( 'slideshowType_1' ) ) {
function slideshowType_1() {
$postid = kk_postid();
$kk_data = array();
$bg_post_meta = get_post_meta($postid, '_custom_bg_type_value', true);
if( empty( $bg_post_meta ) ) {
$bg_post_meta = 'Default';
}
query_posts(array('post_type' => 'slider', 'posts_per_page' => -1));
if( have_posts() && $bg_post_meta == 'Default' ) {
echo '';
} elseif( rwmb_meta( 'kk_homegrid', 'type=image_advanced', $post_id = $postid ) && $bg_post_meta == 'Custom Slideshow' ) {
echo '';
}
if ( $bg_post_meta == 'Custom Slideshow' ) {
$attachments = rwmb_meta( 'kk_homegrid', 'type=image_advanced', $post_id = $postid );
//print_r($attachments);
} elseif ( $bg_post_meta == 'Default' ) {
$kk_data['ifDefault'] = '1';
$attachments = array();
while (have_posts()): the_post();
$full = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$attachments[get_post_thumbnail_id()] = array(
'image' => $full[0],
'title' => get_post_meta(get_the_ID(), '_slide_title_value', true)
);
endwhile;
wp_reset_query();
}
if (!empty($attachments)) {
// Built an array for slider
$kk_data['menuStyle'] = get_option('toppic_theme_menu_style');
$kk_data['randomizeSlides'] = get_option("toppic_theme_fullscreen_start_slide");
$kk_data['transitionType'] = get_option("toppic_theme_fullscreen_effect");
$kk_data['transitionSpeed'] = get_option("toppic_theme_fullscreen_transition");
$kk_data['autoplay'] = array(
'delay' => get_option("toppic_theme_fullscreen_delay"),
);
$kk_data['slides'] = array_merge($attachments);
// Move an array to jQuery
wp_localize_script( 'kk-custom', 'kk_js_fs_slideshow', $kk_data );
}
}
}
if ( ! function_exists( 'slideshowType_2' ) ) {
function slideshowType_2() {
$postid = kk_postid();
// Built an array for slider
$kk_data = array();
$bg_post_meta = get_post_meta($postid, '_custom_bg_type_value', true);
if( empty( $bg_post_meta ) ) {
$bg_post_meta = 'Default';
}
query_posts(array('post_type' => 'slider', 'posts_per_page' => -1));
if( have_posts() && $bg_post_meta == 'Default' ) {
$kk_data['ifDefault'] = '1';
while (have_posts()): the_post();
$full = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$attachments[get_post_thumbnail_id()] = array(
'image' => $full[0],
'title' => get_post_meta(get_the_ID(), '_slide_title_value', true)
);
endwhile;
wp_reset_query();
} elseif ( $bg_post_meta == 'Custom Slideshow' ) {
$attachments = rwmb_meta( 'kk_homegrid', 'type=image_advanced', $post_id = $postid );
}
if (!empty($attachments)) {
// Built an array for slider
$kk_data['fps'] = get_option("toppic_theme_ken_b_frames");
$kk_data['delay'] = get_option("toppic_theme_ken_b_delay");
$kk_data['transitionSpeed'] = get_option("toppic_theme_ken_b_transition");
$kk_data['zoom'] = get_option("toppic_theme_ken_b_zoom");
$kk_data['slides'] = array_merge($attachments);
// Move an array to jQuery
wp_localize_script( 'kk-custom', 'kk_js_fsk_slideshow', $kk_data );
}
}
}
/*-----------------------------------------------------------------------------------*/
/* CUSTOM LOGIN SCREEN
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'my_custom_login_logo' ) ) {
function my_custom_login_logo() {
$logo = get_option('toppic_theme_logo_admin');
if(empty($logo)) $logo=get_admin_url()."images/wordpress-logo.png";
echo '';
}
}
add_action('login_head', 'my_custom_login_logo');
/*-----------------------------------------------------------------------------------*/
/* ADD EXTRA CLASSES TO THE BODY CLASS
/*-----------------------------------------------------------------------------------*/
add_filter( 'body_class' , 'kk_body_class' );
if ( ! function_exists( 'kk_body_class' ) ) {
function kk_body_class( $classes ) {
$postid = kk_postid();
$classes[] = 'kk_vc';
$content_style = get_option( 'toppic_theme_content_style' );
switch ( $content_style ) {
case 'kk-boxed':
$classes[] = 'kk-content-boxed';
break;
case 'kk-full':
$classes[] = 'kk-content-fullwidth';
if ( ( rwmb_meta( 'kk_title_type', 'type=select', $postid ) === 'parallax' ) && ( get_post_meta( $postid, '_gallery_layout_value', true ) !== 'Fullscreen' ) ) {
$classes[] = 'kk-parallax-title';
wp_localize_script( 'kk-custom', 'kk_title_parallax', 'active' );
if ( rwmb_meta( 'kk_title_size', 'type=select', $postid ) === 'full' ) {
$classes[] = 'kk-parallax-title-fullheight';
wp_localize_script( 'kk-custom', 'kk_title_height', 'active' );
}
}
break;
}
$menu_style = get_option( 'toppic_theme_menu_style' );
switch ( $menu_style ) {
case 'kk-menu-default':
$classes[] = 'kk_menu_default';
break;
case 'kk-menu-classic':
$classes[] = 'kk_menu_classic';
break;
case 'kk-menu-default-hidden':
$classes[] = 'kk_menu_default_hidden';
break;
case 'kk-menu-slide-right':
$classes[] = 'kk_menu_slide_right';
break;
case 'kk-menu-left-boxed':
$classes[] = 'kk_menu_left_boxed';
break;
case 'kk-menu-fullscreen':
$classes[] = 'kk_menu_fullscreen';
break;
}
if ( rwmb_meta( 'kk_proof' ) === 'proofing' ) {
$classes[] = 'kk-photo-proofing';
}
if ( ( get_option( 'toppic_theme_is_border' ) == 'true' ) && ( get_option( 'toppic_theme_menu_style' ) == 'kk-menu-slide-right' ) ) {
$classes[] = 'kk-is-borders';
}
if ( in_array( get_post_meta($postid, '_gallery_layout_value', true), array( '2-column', '3-column', '4-column', 'Thumbnails' ) ) && get_post_meta($postid, '_is_masonry_value', true) == 'Yes' || get_post_meta($postid, '_gallery_layout_value', true) == 'Mosaic' ) {
$classes[] = 'kk-masonry';
}
if ( post_password_required($postid) && !is_front_page() && !is_archive() ) {
$classes[] = 'password-protected';
}
if ( get_option( 'toppic_theme_skin_color' ) == 'dark' ) {
$classes[] = 'dark-skin';
}
// return the $classes array
return $classes;
}
}
/*-----------------------------------------------------------------------------------*/
/* COMMENTS NAVIGATION
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'kk_comment_nav' ) ) {
function kk_comment_nav() {
// Are there comments to navigate through?
if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) {
?>
is_search) $query->set('post_type', array('post, page, portfolio, gallery'));
return $query;
}
}
//add_filter('the_search_query', 'toppic_search_all');
if ( ! function_exists( 'my_more_link' ) ) {
function my_more_link( $more_link, $more_link_text ) {
return '
'. __('Read more','toppic') .' ';
}
}
add_filter( 'the_content_more_link', 'my_more_link', 10, 2 );
/*-----------------------------------------------------------------------------------*/
/* INCLUDE STYLES
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'add_styles' ) ) {
function add_styles() {
get_template_part('css/main.css');
echo stripslashes(get_option("toppic_theme_custom_footer"));
}
}
add_action('wp_head', 'add_styles');
/*-----------------------------------------------------------------------------------*/
/* COMMENTS
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'toppic_comment' ) ) {
function toppic_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;?>
post_title );
$link = str_replace("'>![]()
query('post_type=page&posts_per_page=-1');
foreach ($pages as $page) {
$post_custom = get_post_custom($page->ID);
if ($post_custom['_wp_page_template'][0] == 'template-portfolio.php') {
$ppages[] = $page->ID;
}
}
if (!empty($ppages)) {
echo '';
}
}
}
if ( ! function_exists( 'portfolioID' ) ) {
function portfolioID()
{
$ppages = array();
$pages = get_pages(
array(
'meta_key' => '_wp_page_template',
'meta_value' => 'template-portfolio.php'
)
);
foreach ($pages as $page) {
$ppages[] = $page->ID;
}
if (!empty($ppages)) {
return $ppages[0];
}
}
}
if ( ! function_exists( 'galleryID' ) ) {
function galleryID()
{
$ppages = array();
$pages = get_pages(
array(
'meta_key' => '_wp_page_template',
'meta_value' => 'template-gallery.php'
)
);
foreach ($pages as $page) {
$ppages[] = $page->ID;
}
if (!empty($ppages)) {
return $ppages[0];
}
}
}
if ( ! function_exists( 'BlogLink' ) ) {
function BlogLink()
{
$posts_page_id = get_option( 'page_for_posts');
$site_url = home_url() ;
echo '';
}
}
/*-----------------------------------------------------------------------------------*/
/* PAGINATION
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'page_pagination' ) ) {
function page_pagination($pages = '', $range = 2) {
echo "