first commit
This commit is contained in:
1218
wp-content/themes/solarify/inc/helpers.php
Normal file
1218
wp-content/themes/solarify/inc/helpers.php
Normal file
File diff suppressed because it is too large
Load Diff
789
wp-content/themes/solarify/inc/hooks.php
Normal file
789
wp-content/themes/solarify/inc/hooks.php
Normal file
@@ -0,0 +1,789 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters and Actions
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'solarify_action_setup' ) ) :
|
||||
/**
|
||||
* Theme setup.
|
||||
*
|
||||
* Set up theme defaults and registers support for various WordPress features.
|
||||
*
|
||||
* Note that this function is hooked into the after_setup_theme hook, which
|
||||
* runs before the init hook. The init hook is too late for some features, such
|
||||
* as indicating support post thumbnails.
|
||||
* @internal
|
||||
*/
|
||||
function solarify_action_setup() {
|
||||
|
||||
/*
|
||||
* Make Theme available for translation.
|
||||
*/
|
||||
load_theme_textdomain( 'solarify', SOLARIFY_THEME_PATH . '/languages' );
|
||||
|
||||
add_editor_style( array( 'css/main.css' ) );
|
||||
|
||||
// Add RSS feed links to <head> for posts and comments.
|
||||
add_theme_support( 'automatic-feed-links' );
|
||||
|
||||
// Enable support for Post Thumbnails, and declare two sizes.
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
|
||||
//Let WordPress manage the document title.
|
||||
add_theme_support( 'title-tag' );
|
||||
|
||||
set_post_thumbnail_size( 775, 517, true );
|
||||
add_image_size( 'solarify-full-width', 1170, 780, true );
|
||||
add_image_size( 'solarify-small-width', 500, 800, true );
|
||||
add_image_size( 'solarify-square-width', 780, 780, true );
|
||||
|
||||
//content width
|
||||
$GLOBALS['content_width'] = apply_filters( 'solarify_filter_content_width', 891 );
|
||||
|
||||
/*
|
||||
* 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 http://codex.wordpress.org/Post_Formats
|
||||
*/
|
||||
add_theme_support( 'post-formats', array(
|
||||
'standard',
|
||||
'aside',
|
||||
'chat',
|
||||
'gallery',
|
||||
'link',
|
||||
'image',
|
||||
'quote',
|
||||
'status',
|
||||
'video',
|
||||
'audio',
|
||||
) );
|
||||
|
||||
// Declare WooCommerce support
|
||||
add_theme_support( 'woocommerce' );
|
||||
} //solarify_action_setup()
|
||||
|
||||
endif;
|
||||
add_action( 'after_setup_theme', 'solarify_action_setup' );
|
||||
|
||||
|
||||
/**
|
||||
* Extend the default WordPress body classes.
|
||||
*
|
||||
* Adds body classes to denote:
|
||||
* 1. Single or multiple authors.
|
||||
* 2. Presence of header image.
|
||||
* 3. Index views.
|
||||
* 4. Full-width content layout.
|
||||
* 5. Presence of footer widgets.
|
||||
* 6. Single views.
|
||||
* 7. Featured content layout.
|
||||
*
|
||||
* @param array $classes A list of existing body class values.
|
||||
*
|
||||
* @return array The filtered body class list.
|
||||
* @internal
|
||||
*/
|
||||
if ( !function_exists( 'solarify_filter_body_classes' ) ) :
|
||||
function solarify_filter_body_classes( $classes ) {
|
||||
if ( is_multi_author() ) {
|
||||
$classes[] = 'group-blog';
|
||||
}
|
||||
|
||||
if ( get_header_image() ) {
|
||||
$classes[] = 'header-image';
|
||||
} else {
|
||||
$classes[] = 'masthead-fixed';
|
||||
}
|
||||
|
||||
if ( is_archive() || is_search() || is_home() ) {
|
||||
$classes[] = 'archive-list-view';
|
||||
}
|
||||
|
||||
if ( function_exists( 'fw_ext_sidebars_get_current_position' ) ) {
|
||||
$current_position = fw_ext_sidebars_get_current_position();
|
||||
if ( in_array( $current_position, array( 'full', 'left' ) )
|
||||
|| empty( $current_position )
|
||||
|| is_page_template( 'page-templates/full-width.php' )
|
||||
|| is_attachment()
|
||||
) {
|
||||
$classes[] = 'full-width';
|
||||
}
|
||||
} else {
|
||||
$classes[] = 'full-width';
|
||||
}
|
||||
|
||||
if ( is_active_sidebar( 'sidebar-footer' ) ) {
|
||||
$classes[] = 'footer-widgets';
|
||||
}
|
||||
|
||||
if ( is_singular() && ! is_front_page() ) {
|
||||
$classes[] = 'singular';
|
||||
}
|
||||
|
||||
if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
|
||||
$classes[] = 'slider';
|
||||
} elseif ( is_front_page() ) {
|
||||
$classes[] = 'grid';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
} //solarify_filter_body_classes()
|
||||
endif;
|
||||
add_filter( 'body_class', 'solarify_filter_body_classes' );
|
||||
|
||||
//changing default comment form
|
||||
if ( ! function_exists( 'solarify_filter_solarify_contact_form_fields' ) ) :
|
||||
function solarify_filter_solarify_contact_form_fields( $fields ) {
|
||||
$commenter = wp_get_current_commenter();
|
||||
$user = wp_get_current_user();
|
||||
$user_identity = $user->exists() ? $user->display_name : '';
|
||||
$req = get_option( 'require_name_email' );
|
||||
$aria_req = ( $req ? " aria-required='true'" : '' );
|
||||
$html_req = ( $req ? " required='required'" : '' );
|
||||
$html5 = 'html5';
|
||||
$fields = array(
|
||||
'author' => '<div class="col-sm-6"><p class="comment-form-author">' . '<label for="author">' . esc_html__( 'Name', 'solarify' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
|
||||
'<input id="author" class="form-control" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . $html_req . ' placeholder="' . esc_html__( 'Your Name*', 'solarify' ) . '"></p></div>',
|
||||
'email' => '<div class="col-sm-6"><p class="comment-form-email"><label for="email">' . esc_html__( 'Email', 'solarify' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
|
||||
'<input id="email" class="form-control" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" ' . $aria_req . $html_req . ' placeholder="' . esc_html__( 'Email Address*', 'solarify' ) . '"/></p></div>',
|
||||
'comment_field' => '<div class="col-sm-12"><p class="comment-form-comment"><label for="comment">' . esc_html_x( 'Comment', 'noun', 'solarify' ) . '</label> <textarea id="comment" class="form-control" name="comment" cols="45" rows="5" aria-required="true" required="required" placeholder="' . esc_html__( 'Comment', 'solarify' ) . '"></textarea></p></div>',
|
||||
);
|
||||
|
||||
return $fields;
|
||||
} //solarify_filter_solarify_contact_form_fields()
|
||||
|
||||
endif;
|
||||
add_filter( 'comment_form_default_fields', 'solarify_filter_solarify_contact_form_fields' );
|
||||
|
||||
|
||||
//changing gallery thumbnail size for entry-thumbnail display
|
||||
if ( ! function_exists( 'solarify_filter_fw_shortcode_atts_gallery' ) ) :
|
||||
function solarify_filter_fw_shortcode_atts_gallery( $out, $pairs, $atts ) {
|
||||
$out['size'] = 'post-thumbnail';
|
||||
return $out;
|
||||
} //solarify_filter_fw_shortcode_atts_gallery()
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'solarify_shortcode_atts_gallery_trigger' ) ) :
|
||||
function solarify_shortcode_atts_gallery_trigger( $add_filter = true ) {
|
||||
if ( $add_filter ) {
|
||||
add_filter( 'shortcode_atts_gallery', 'solarify_filter_fw_shortcode_atts_gallery', 10, 3 );
|
||||
} else {
|
||||
remove_filter( 'shortcode_atts_gallery', 'solarify_filter_fw_shortcode_atts_gallery', 10, 3 );
|
||||
}
|
||||
} //solarify_shortcode_atts_gallery_trigger()
|
||||
endif;
|
||||
|
||||
//changing events slug
|
||||
if ( ! function_exists( 'solarify_filter_fw_ext_events_post_slug' ) ) :
|
||||
function solarify_filter_fw_ext_events_post_slug( $slug ) {
|
||||
return 'event';
|
||||
} //solarify_filter_fw_ext_events_post_slug()
|
||||
endif;
|
||||
add_filter( 'fw_ext_events_post_slug', 'solarify_filter_fw_ext_events_post_slug' );
|
||||
|
||||
if ( ! function_exists( 'solarify_filter_fw_ext_events_taxonomy_slug' ) ) :
|
||||
function solarify_filter_fw_ext_events_taxonomy_slug( $slug ) {
|
||||
return 'events';
|
||||
} //solarify_filter_fw_ext_events_taxonomy_slug()
|
||||
endif;
|
||||
add_filter( 'fw_ext_events_taxonomy_slug', 'solarify_filter_fw_ext_events_taxonomy_slug' );
|
||||
|
||||
//wrapping in a span categories and archives items count
|
||||
if ( !function_exists('solarify_filter_add_span_to_arhcive_widget_count') ) :
|
||||
function solarify_filter_add_span_to_arhcive_widget_count( $links ) {
|
||||
//for categories widget
|
||||
$links = str_replace( '</a> (', '</a> <span class="highlight">(', $links );
|
||||
//for archive widget
|
||||
$links = str_replace( ' (', '</a> <span class="highlight">(', $links );
|
||||
$links = preg_replace( '/([0-9]+)\)/', '$1)</span>', $links );
|
||||
|
||||
return $links;
|
||||
} //solarify_filter_add_span_to_arhcive_widget_count()
|
||||
endif;
|
||||
|
||||
//categories
|
||||
add_filter( 'wp_list_categories', 'solarify_filter_add_span_to_arhcive_widget_count' );
|
||||
//arhcive
|
||||
add_filter( 'get_archives_link', 'solarify_filter_add_span_to_arhcive_widget_count' );
|
||||
|
||||
|
||||
if ( !function_exists( 'solarify_filter_monster_widget_text' ) ) :
|
||||
function solarify_filter_monster_widget_text( $text ) {
|
||||
$text = str_replace( 'name="monster-widget-just-testing"', 'name="monster-widget-just-testing" class="form-control"', $text );
|
||||
|
||||
return $text;
|
||||
}
|
||||
endif;
|
||||
add_filter( 'monster-widget-get-text', 'solarify_filter_monster_widget_text' );
|
||||
|
||||
|
||||
/**
|
||||
* Extend the default WordPress post classes.
|
||||
*
|
||||
* Adds a post class to denote:
|
||||
* Non-password protected page with a post thumbnail.
|
||||
*
|
||||
* @param array $classes A list of existing post class values.
|
||||
*
|
||||
* @return array The filtered post class list.
|
||||
* @internal
|
||||
*/
|
||||
if ( !function_exists( 'solarify_filter_post_classes' ) ) :
|
||||
function solarify_filter_post_classes( $classes ) {
|
||||
if ( ! post_password_required() && ! is_attachment() && has_post_thumbnail() ) {
|
||||
$classes[] = 'has-post-thumbnail';
|
||||
}
|
||||
return $classes;
|
||||
} //solarify_filter_post_classes()
|
||||
endif;
|
||||
add_filter( 'post_class', 'solarify_filter_post_classes' );
|
||||
|
||||
|
||||
/**
|
||||
* Add bootstrap CSS classes to default password protected form.
|
||||
*
|
||||
*
|
||||
* @return string HTML code of password form
|
||||
* @internal
|
||||
*/
|
||||
if ( !function_exists( 'solarify_filter_password_form' ) ) :
|
||||
function solarify_filter_password_form( $html ) {
|
||||
$label = esc_html__( 'Password', 'solarify' );
|
||||
$html = str_replace( 'input name="post_password"', 'input class="form-control" name="post_password" placeholder="' . $label . '"', $html );
|
||||
$html = str_replace( 'input type="submit"', 'input class="theme_button inverse" type="submit"', $html );
|
||||
|
||||
return $html;
|
||||
} //solarify_filter_password_form()
|
||||
endif;
|
||||
add_filter( 'the_password_form', 'solarify_filter_password_form' );
|
||||
|
||||
|
||||
/**
|
||||
* Add bootstrap CSS class to readmore blog feed anchor.
|
||||
*
|
||||
*
|
||||
* @return string HTML code of password form
|
||||
* @internal
|
||||
*/
|
||||
if ( !function_exists( 'solarify_filter_gallery_post_style_owl') ) :
|
||||
function solarify_filter_gallery_post_style_owl( $gallery_html ) {
|
||||
if ( $gallery_html && ! is_admin() ) {
|
||||
$gallery_html = str_replace( 'gallery ', 'isotope_container ', $gallery_html );
|
||||
//if page is current
|
||||
}
|
||||
|
||||
return $gallery_html;
|
||||
} //solarify_filter_gallery_post_style_owl()
|
||||
endif;
|
||||
add_filter( 'gallery_style', 'solarify_filter_gallery_post_style_owl' );
|
||||
|
||||
/**
|
||||
* Flush out the transients used in solarify_categorized_blog.
|
||||
* @internal
|
||||
*/
|
||||
if ( !function_exists( 'solarify_action_category_transient_flusher' ) ) :
|
||||
function solarify_action_category_transient_flusher() {
|
||||
delete_transient( 'solarify_category_count' );
|
||||
} //solarify_action_category_transient_flusher()
|
||||
endif;
|
||||
add_action( 'edit_category', 'solarify_action_category_transient_flusher' );
|
||||
add_action( 'save_post', 'solarify_action_category_transient_flusher' );
|
||||
|
||||
|
||||
/**
|
||||
* Register widget areas.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
if ( !function_exists( 'solarify_action_widgets_init' ) ) :
|
||||
function solarify_action_widgets_init() {
|
||||
register_sidebar( array(
|
||||
'name' => esc_html__( 'Main Widget Area', 'solarify' ),
|
||||
'id' => 'sidebar-main',
|
||||
'description' => esc_html__( 'Appears in the content section of the site.', 'solarify' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h3 class="widget-title">',
|
||||
'after_title' => '</h3>',
|
||||
) );
|
||||
|
||||
register_sidebar( array(
|
||||
'name' => esc_html__( 'Shop Widget Area', 'solarify' ),
|
||||
'id' => 'sidebar-shop',
|
||||
'description' => esc_html__( 'Appears on the shop page of the site.', 'solarify' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h3 class="widget-title">',
|
||||
'after_title' => '</h3>',
|
||||
) );
|
||||
|
||||
register_sidebar( array(
|
||||
'name' => esc_html__( 'Footer Widget Area', 'solarify' ),
|
||||
'id' => 'sidebar-footer',
|
||||
'description' => esc_html__( 'Appears in the footer section of the site.', 'solarify' ),
|
||||
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h3 class="widget-title">',
|
||||
'after_title' => '</h3>',
|
||||
) );
|
||||
} //solarify_action_widgets_init()
|
||||
endif;
|
||||
add_action( 'widgets_init', 'solarify_action_widgets_init' );
|
||||
|
||||
/**
|
||||
* Processing google fonts customizer options
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'solarify_action_process_google_fonts' ) ) :
|
||||
function solarify_action_process_google_fonts() {
|
||||
$google_fonts = fw_get_google_fonts();
|
||||
$include_from_google = array();
|
||||
|
||||
$font_body = fw_get_db_customizer_option( 'main_font' );
|
||||
$font_headings = fw_get_db_customizer_option( 'h_font' );
|
||||
|
||||
// if is google font
|
||||
if ( isset( $google_fonts[ $font_body['family'] ] ) ) {
|
||||
$include_from_google[ $font_body['family'] ] = $google_fonts[ $font_body['family'] ];
|
||||
}
|
||||
|
||||
if ( isset( $google_fonts[ $font_headings['family'] ] ) ) {
|
||||
$include_from_google[ $font_headings['family'] ] = $google_fonts[ $font_headings['family'] ];
|
||||
}
|
||||
|
||||
$google_fonts_links = solarify_get_remote_fonts( $include_from_google );
|
||||
// set a option in db for save google fonts link
|
||||
update_option( 'solarify_google_fonts_link', $google_fonts_links );
|
||||
} //solarify_action_process_google_fonts()
|
||||
|
||||
endif;
|
||||
add_action( 'customize_save_after', 'solarify_action_process_google_fonts', 999, 2 );
|
||||
|
||||
if ( ! function_exists( 'solarify_get_remote_fonts' ) ) :
|
||||
function solarify_get_remote_fonts( $include_from_google ) {
|
||||
/**
|
||||
* Get remote fonts
|
||||
*
|
||||
* @param array $include_from_google
|
||||
*/
|
||||
if ( ! sizeof( $include_from_google ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$html = "<link href='http://fonts.googleapis.com/css?family=";
|
||||
|
||||
foreach ( $include_from_google as $font => $styles ) {
|
||||
$html .= str_replace( ' ', '+', $font ) . ':' . implode( ',', $styles['variants'] ) . '|';
|
||||
}
|
||||
|
||||
$html = substr( $html, 0, - 1 );
|
||||
$html .= "' rel='stylesheet' type='text/css'>";
|
||||
|
||||
return $html;
|
||||
} //solarify_get_remote_fonts()
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'solarify_action_add_login_page_script_and_styles' ) ) :
|
||||
function solarify_action_add_login_page_script_and_styles( $page ) {
|
||||
wp_enqueue_style(
|
||||
'solarify-login-page-style',
|
||||
SOLARIFY_THEME_URI . '/css/login-page.css',
|
||||
array(),
|
||||
'1.0'
|
||||
);
|
||||
wp_enqueue_script(
|
||||
'solarify-login-page-script',
|
||||
SOLARIFY_THEME_URI . '/js/login-page.js',
|
||||
array( 'jquery' ),
|
||||
'1.0',
|
||||
false
|
||||
);
|
||||
}
|
||||
endif;
|
||||
add_action( 'login_enqueue_scripts', 'solarify_action_add_login_page_script_and_styles' );
|
||||
|
||||
|
||||
//admin dashboard styles and scripts
|
||||
if ( ! function_exists( 'solarify_action_load_custom_wp_admin_style' ) ) :
|
||||
function solarify_action_load_custom_wp_admin_style() {
|
||||
wp_register_style( 'solarify_custom_wp_admin_css', SOLARIFY_THEME_URI . '/css/admin-style.css', false, '1.0.0' );
|
||||
wp_enqueue_style( 'solarify_custom_wp_admin_css' );
|
||||
|
||||
wp_register_style( 'solarify_custom_wp_admin_fonts', SOLARIFY_THEME_URI . '/css/fonts.css', false, '1.0.0' );
|
||||
wp_enqueue_style( 'solarify_custom_wp_admin_fonts' );
|
||||
|
||||
if ( defined( 'FW' ) ) {
|
||||
wp_enqueue_script(
|
||||
'solarify-dashboard-widget-script',
|
||||
SOLARIFY_THEME_URI . '/js/dashboard-widget-script.js',
|
||||
array( 'jquery' ),
|
||||
'1.0',
|
||||
false
|
||||
);
|
||||
}
|
||||
} //solarify_action_load_custom_wp_admin_style()
|
||||
endif;
|
||||
add_action( 'admin_enqueue_scripts', 'solarify_action_load_custom_wp_admin_style' );
|
||||
|
||||
|
||||
// removing woo styles
|
||||
// Remove each style one by one
|
||||
if ( !function_exists('solarify_filter_solarify_dequeue_styles')) :
|
||||
function solarify_filter_solarify_dequeue_styles( $enqueue_styles ) {
|
||||
unset( $enqueue_styles['woocommerce-general'] ); // Remove the gloss
|
||||
unset( $enqueue_styles['woocommerce-layout'] ); // Remove the layout
|
||||
unset( $enqueue_styles['woocommerce-smallscreen'] ); // Remove the smallscreen optimisation
|
||||
return $enqueue_styles;
|
||||
} //solarify_filter_solarify_dequeue_styles()
|
||||
endif;
|
||||
add_filter( 'woocommerce_enqueue_styles', '__return_false' );
|
||||
|
||||
//this action defined in functions.php
|
||||
add_action( 'tgmpa_register', 'solarify_action_register_required_plugins' );
|
||||
|
||||
if ( !function_exists('solarify_filter_wrap_cat_title_before_colon_in_span')) :
|
||||
function solarify_filter_wrap_cat_title_before_colon_in_span($title) {
|
||||
return preg_replace('/^.*: /', '<span class="taxonomy-name-title">${0}</span>', $title );
|
||||
}
|
||||
endif;
|
||||
add_filter('get_the_archive_title', 'solarify_filter_wrap_cat_title_before_colon_in_span');
|
||||
|
||||
|
||||
//if Unyson installed - managing main slider and contact form scripts, sidebars
|
||||
if ( defined( 'FW' ) ):
|
||||
//display main slider
|
||||
if ( ! function_exists( 'solarify_action_slider' ) ):
|
||||
|
||||
function solarify_action_slider() {
|
||||
if(is_search()) {
|
||||
return;
|
||||
}
|
||||
$slider_id = fw_get_db_post_option( get_the_ID(), 'slider_id', false );
|
||||
if ( fw_ext( 'slider' ) ) {
|
||||
echo fw()->extensions->get( 'slider' )->render_slider( $slider_id, false );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_action( 'solarify_slider', 'solarify_action_slider' );
|
||||
|
||||
endif;
|
||||
|
||||
//display blog slider
|
||||
if ( ! function_exists( 'solarify_action_blog_slider' ) ):
|
||||
|
||||
function solarify_action_blog_slider() {
|
||||
|
||||
$blog_slider_options = function_exists( 'fw_get_db_customizer_option' ) ? fw_get_db_customizer_option( 'blog_slider_switch' ) : '';
|
||||
$blog_slider_enabled = $blog_slider_options['yes'];
|
||||
if( $blog_slider_enabled ) {
|
||||
$slider_id= $blog_slider_enabled['slider_id'];
|
||||
if ( fw_ext( 'slider' ) ) {
|
||||
$slider_html = fw()->extensions->get( 'slider' )->render_slider( $slider_id, false );
|
||||
if( !empty( $slider_html ) ) {
|
||||
?>
|
||||
<div class="blog-slider col-sm-12">
|
||||
<?php
|
||||
echo fw()->extensions->get( 'slider' )->render_slider( $slider_id, false );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'solarify_blog_slider', 'solarify_action_blog_slider' );
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Display current submitted FW_Form errors
|
||||
* @return array
|
||||
*/
|
||||
if ( ! function_exists( 'solarify_action_display_form_errors' ) ):
|
||||
function solarify_action_display_form_errors() {
|
||||
$form = FW_Form::get_submitted();
|
||||
|
||||
if ( ! $form || $form->is_valid() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_enqueue_script(
|
||||
'solarify-show-form-errors',
|
||||
SOLARIFY_THEME_URI . '/js/form-errors.js',
|
||||
array( 'jquery' ),
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script( 'solarify-show-form-errors', '_localized_form_errors', array(
|
||||
'errors' => $form->get_errors(),
|
||||
'form_id' => $form->get_id()
|
||||
) );
|
||||
}
|
||||
endif;
|
||||
add_action( 'wp_enqueue_scripts', 'solarify_action_display_form_errors' );
|
||||
|
||||
|
||||
//removing standard sliders from Unyson - we use our theme slider
|
||||
if ( !function_exists( 'solarify_filter_disable_sliders' ) ) :
|
||||
function solarify_filter_disable_sliders( $sliders ) {
|
||||
foreach ( array( 'owl-carousel', 'bx-slider', 'nivo-slider' ) as $name ) {
|
||||
$key = array_search( $name, $sliders );
|
||||
unset( $sliders[ $key ] );
|
||||
}
|
||||
|
||||
return $sliders;
|
||||
}
|
||||
endif;
|
||||
|
||||
add_filter( 'fw_ext_slider_activated', 'solarify_filter_disable_sliders' );
|
||||
|
||||
//removing standard fields from Unyson slider - we use our own slider fields
|
||||
if ( !function_exists( 'solarify_slider_population_method_custom_options' ) ) :
|
||||
function solarify_slider_population_method_custom_options( $arr ) {
|
||||
/**
|
||||
* Filter for disable standard slider fields for carousel slider
|
||||
*
|
||||
* @param array $arr
|
||||
*/
|
||||
unset(
|
||||
$arr['wrapper-population-method-custom']['options']['custom-slides']['slides_options']['title'],
|
||||
$arr['wrapper-population-method-custom']['options']['custom-slides']['slides_options']['desc']
|
||||
);
|
||||
|
||||
return $arr;
|
||||
}
|
||||
endif;
|
||||
add_filter( 'fw_ext_theme_slider_population_method_custom_options', 'solarify_slider_population_method_custom_options' );
|
||||
|
||||
//adding custom sidebar for shop page if WooCommerce active
|
||||
if ( class_exists( 'WooCommerce' ) ) :
|
||||
if ( !function_exists( 'solarify_filter_fw_ext_sidebars_add_conditional_tag' ) ) :
|
||||
function solarify_filter_fw_ext_sidebars_add_conditional_tag($conditional_tags) {
|
||||
$conditional_tags['is_archive_page_slug'] = array(
|
||||
'order_option' => 2, // (optional: default is 1) position in the 'Others' lists in backend
|
||||
'check_priority' => 'last', // (optional: default is last, can be changed to 'first') use it to change priority checking conditional tag
|
||||
'name' => esc_html__('Products Type - Shop', 'solarify'), // conditional tag title
|
||||
'conditional_tag' => array(
|
||||
'callback' => 'is_shop', // existing callback
|
||||
'params' => array('products') //parameters for callback
|
||||
)
|
||||
);
|
||||
|
||||
return $conditional_tags;
|
||||
}
|
||||
endif;
|
||||
add_filter('fw_ext_sidebars_conditional_tags', 'solarify_filter_fw_ext_sidebars_add_conditional_tag' );
|
||||
|
||||
remove_theme_support( 'wc-product-gallery-zoom' );
|
||||
remove_theme_support( 'wc-product-gallery-lightbox' );
|
||||
remove_theme_support( 'wc-product-gallery-slider' );
|
||||
endif; //WooCommerce
|
||||
|
||||
//theme icon fonts
|
||||
if ( ! function_exists( 'solarify_filter_custom_packs_list' ) ) :
|
||||
function solarify_filter_custom_packs_list($current_packs) {
|
||||
/**
|
||||
* $current_packs is an array of pack names.
|
||||
* You should return which one you would like to show in the picker.
|
||||
*/
|
||||
return array('social_icons', 'solarify_icons', 'font-awesome');
|
||||
}
|
||||
endif;
|
||||
add_filter('fw:option_type:icon-v2:filter_packs', 'solarify_filter_custom_packs_list');
|
||||
|
||||
if ( ! function_exists( 'solarify_filter_add_my_icon_pack' ) ) :
|
||||
function solarify_filter_add_my_icon_pack($default_packs) {
|
||||
/**
|
||||
* No fear. Defaults packs will be merged in back. You can't remove them.
|
||||
* Changing some flags for them is allowed.
|
||||
*/
|
||||
return array(
|
||||
'solarify_icons' => array(
|
||||
'name' => 'solarify_icons', // same as key
|
||||
'title' => 'Solarify Icons',
|
||||
'css_class_prefix' => 'rt-icon2',
|
||||
'css_file' => SOLARIFY_THEME_PATH . '/css/fonts.css',
|
||||
'css_file_uri' => SOLARIFY_THEME_URI . '/css/fonts.css',
|
||||
),
|
||||
'social_icons' => array(
|
||||
'name' => 'social_icons', // same as key
|
||||
'title' => 'Social Icons',
|
||||
'css_class_prefix' => 'socicon',
|
||||
'css_file' => SOLARIFY_THEME_PATH . '/css/fonts.css',
|
||||
'css_file_uri' => SOLARIFY_THEME_URI . '/css/fonts.css',
|
||||
)
|
||||
);
|
||||
}
|
||||
endif;
|
||||
add_filter('fw:option_type:icon-v2:packs', 'solarify_filter_add_my_icon_pack');
|
||||
|
||||
if ( ! function_exists( 'solarify_breadcrumbs_blank_search_query_fix' ) ) :
|
||||
/**
|
||||
* Breadcrumbs modifications
|
||||
*/
|
||||
function solarify_breadcrumbs_blank_search_query_fix( $items ) {
|
||||
|
||||
if ( is_search() ) {
|
||||
if ( trim ( get_search_query() ) == false ) {
|
||||
$items[ sizeof( $items ) - 1 ]['name'] = esc_html__( 'Search', 'solarify' );
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
endif;
|
||||
|
||||
add_filter( 'fw_ext_breadcrumbs_build', 'solarify_breadcrumbs_blank_search_query_fix' );
|
||||
|
||||
//enable tags for events
|
||||
if ( ! function_exists( 'solarify_add_tags_for_events_unyson_extension' ) ) :
|
||||
function solarify_add_tags_for_events_unyson_extension() {
|
||||
return true;
|
||||
}
|
||||
endif;
|
||||
|
||||
add_filter('fw:ext:events:enable-tags', 'solarify_add_tags_for_events_unyson_extension');
|
||||
|
||||
endif; //defined('FW')
|
||||
|
||||
//adding custom styles to TinyMCE
|
||||
// Callback function to insert 'styleselect' into the $buttons array
|
||||
if ( ! function_exists( 'solarify_filter_mce_theme_format_insert_button' ) ) :
|
||||
function solarify_filter_mce_theme_format_insert_button( $buttons ) {
|
||||
array_unshift( $buttons, 'styleselect' );
|
||||
|
||||
return $buttons;
|
||||
} //solarify_filter_mce_theme_format_insert_button()
|
||||
endif;
|
||||
// Register our callback to the appropriate filter
|
||||
add_filter( 'mce_buttons_2', 'solarify_filter_mce_theme_format_insert_button' );
|
||||
// Callback function to filter the MCE settings
|
||||
if ( ! function_exists( 'solarify_filter_mce_theme_format_add_styles' ) ) :
|
||||
function solarify_filter_mce_theme_format_add_styles( $init_array ) {
|
||||
// Define the style_formats array
|
||||
$style_formats = array(
|
||||
// Each array child is a format with it's own settings
|
||||
array(
|
||||
'title' => esc_html__( 'Excerpt', 'solarify' ),
|
||||
'block' => 'p',
|
||||
'classes' => 'entry-excerpt',
|
||||
'wrapper' => false,
|
||||
),
|
||||
array(
|
||||
'title' => esc_html__( 'Paragraph with dropcap', 'solarify' ),
|
||||
'block' => 'p',
|
||||
'classes' => 'big-first-letter',
|
||||
'wrapper' => false,
|
||||
),
|
||||
array(
|
||||
'title' => esc_html__( 'Main theme color', 'solarify' ),
|
||||
'inline' => 'span',
|
||||
'classes' => 'highlight',
|
||||
'wrapper' => false,
|
||||
),
|
||||
|
||||
);
|
||||
// Insert the array, JSON ENCODED, into 'style_formats'
|
||||
$init_array['style_formats'] = json_encode( $style_formats );
|
||||
|
||||
return $init_array;
|
||||
|
||||
} //solarify_filter_mce_theme_format_add_styles()
|
||||
endif;
|
||||
// Attach callback to 'tiny_mce_before_init'
|
||||
add_filter( 'tiny_mce_before_init', 'solarify_filter_mce_theme_format_add_styles', 1 );
|
||||
|
||||
|
||||
//demo content on remote hosting
|
||||
/**
|
||||
* @param FW_Ext_Backups_Demo[] $demos
|
||||
*
|
||||
* @return FW_Ext_Backups_Demo[]
|
||||
*/
|
||||
|
||||
|
||||
if ( ! function_exists( 'solarify_filter_theme_fw_ext_backups_demos' ) ) :
|
||||
|
||||
function solarify_filter_theme_fw_ext_backups_demos( $demos ) {
|
||||
$demo_version_suffix = '-v' . SOLARIFY_REMOTE_DEMO_VERSION; // '-v1.0.0'
|
||||
|
||||
$demos_array = array (
|
||||
'solarify-demo' . $demo_version_suffix => array (
|
||||
'title' => esc_html__( 'Solarify Demo', 'solarify' ),
|
||||
'screenshot' => esc_url('http://webdesign-finder.com/remote-demo-content/solarify/demo/screenshot.png'),
|
||||
'preview_link' => false,
|
||||
),
|
||||
);
|
||||
|
||||
// You may request this demo id from this theme author to get a colorized demo content. See the author contacts information.
|
||||
$secret_demo_id = SOLARIFY_REMOTE_DEMO_ID;
|
||||
if ( $secret_demo_id ) {
|
||||
$demos_array['solarify-demo-colorized-' . $secret_demo_id . $demo_version_suffix] = array(
|
||||
'title' => esc_html__('Solarify Demo Colorized', 'solarify'),
|
||||
'screenshot' => esc_url('http://webdesign-finder.com/remote-demo-content/solarify/demo-colorized/screenshot.png'),
|
||||
'preview_link' => false,
|
||||
);
|
||||
}
|
||||
|
||||
// remote demo URL
|
||||
$download_url = esc_url('http://webdesign-finder.com/remote-demo-content/solarify');
|
||||
|
||||
foreach ( $demos_array as $id => $data ) {
|
||||
$demo = new FW_Ext_Backups_Demo( $id, 'piecemeal', array (
|
||||
'url' => $download_url,
|
||||
'file_id' => $id,
|
||||
) );
|
||||
$demo->set_title( $data[ 'title' ] );
|
||||
$demo->set_screenshot( $data[ 'screenshot' ] );
|
||||
$demo->set_preview_link( $data[ 'preview_link' ] );
|
||||
|
||||
$demos[ $demo->get_id() ] = $demo;
|
||||
|
||||
unset( $demo );
|
||||
}
|
||||
|
||||
return $demos;
|
||||
} //solarify_filter_theme_fw_ext_backups_demos()
|
||||
endif;
|
||||
add_filter( 'fw:ext:backups-demo:demos', 'solarify_filter_theme_fw_ext_backups_demos' );
|
||||
|
||||
|
||||
//////////
|
||||
//Booked//
|
||||
//////////
|
||||
//Remove Booked plugin front-end color theme (color-theme.php)
|
||||
if( class_exists('booked_plugin')) {
|
||||
remove_action( 'wp_enqueue_scripts', array('booked_plugin', 'front_end_color_theme'));
|
||||
}//Booked
|
||||
|
||||
//renaming projects to gallery
|
||||
if ( ! function_exists( 'solarify_projects_change_post_names' ) ):
|
||||
function solarify_projects_change_post_names() {
|
||||
return array(
|
||||
'singular' => esc_html__( 'Project', 'solarify' ),
|
||||
'plural' => esc_html__( 'Gallery', 'solarify' )
|
||||
);
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'fw_ext_projects_post_type_name', 'solarify_projects_change_post_names' );
|
||||
|
||||
//add comments support to gallery
|
||||
add_post_type_support( 'fw-portfolio', 'comments' );
|
||||
199
wp-content/themes/solarify/inc/init.php
Normal file
199
wp-content/themes/solarify/inc/init.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Theme Includes
|
||||
*/
|
||||
class Solarify_Theme_Includes {
|
||||
private static $rel_path = null;
|
||||
|
||||
private static $include_isolated_callable;
|
||||
|
||||
private static $initialized = false;
|
||||
|
||||
public static $template_directory = '';
|
||||
|
||||
public static $template_directory_uri = '';
|
||||
|
||||
public static function init() {
|
||||
if ( self::$initialized ) {
|
||||
return;
|
||||
} else {
|
||||
self::$initialized = true;
|
||||
}
|
||||
|
||||
//theme path
|
||||
self::$template_directory = SOLARIFY_THEME_PATH;
|
||||
|
||||
self::$template_directory_uri = SOLARIFY_THEME_URI;
|
||||
// var_dump(self::$template_directory_uri);
|
||||
|
||||
/**
|
||||
* Include a file isolated, to not have access to current context variables
|
||||
*/
|
||||
self::$include_isolated_callable = create_function( '$path', 'include $path;' );
|
||||
|
||||
/**
|
||||
* Both frontend and backend
|
||||
*/
|
||||
{
|
||||
self::include_child_first( '/helpers.php' );
|
||||
self::include_child_first( '/hooks.php' );
|
||||
|
||||
//files from '/includes' folder - instead of auto loading with 'self::include_all_child_first' :
|
||||
self::include_child_first( '/sub-includes/class-theme-comments-walker.php' );
|
||||
self::include_child_first( '/sub-includes/custom-kses.php' );
|
||||
self::include_child_first( '/sub-includes/icons-rt.php' );
|
||||
self::include_child_first( '/sub-includes/icons-social.php' );
|
||||
self::include_child_first( '/sub-includes/mod-post-likes.php' );
|
||||
self::include_child_first( '/sub-includes/mod-post-views.php' );
|
||||
self::include_child_first( '/sub-includes/mod-widget-adds.php' );
|
||||
self::include_child_first( '/sub-includes/template-tags.php' );
|
||||
self::include_child_first( '/sub-includes/woocommerce.php' );
|
||||
|
||||
add_action( 'init', array( __CLASS__, '_action_init' ) );
|
||||
add_action( 'widgets_init', array( __CLASS__, '_action_widgets_init' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Only frontend
|
||||
*/
|
||||
if ( ! is_admin() ) {
|
||||
add_action( 'wp_enqueue_scripts', array( __CLASS__, '_action_enqueue_scripts' ),
|
||||
20 // Include later to be able to make wp_dequeue_style|script()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static function get_rel_path( $append = '' ) {
|
||||
if ( self::$rel_path === null ) {
|
||||
self::$rel_path = '/inc';
|
||||
}
|
||||
|
||||
return self::$rel_path . $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dirname 'foo-bar'
|
||||
*
|
||||
* @return string 'Foo_Bar'
|
||||
*/
|
||||
private static function dirname_to_classname( $dirname ) {
|
||||
$class_name = explode( '-', $dirname );
|
||||
$class_name = array_map( 'ucfirst', $class_name );
|
||||
$class_name = implode( '_', $class_name );
|
||||
|
||||
return $class_name;
|
||||
}
|
||||
|
||||
public static function get_parent_path( $rel_path ) {
|
||||
return SOLARIFY_THEME_PATH . self::get_rel_path( $rel_path );
|
||||
}
|
||||
|
||||
public static function get_child_path( $rel_path ) {
|
||||
if ( ! is_child_theme() ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return get_theme_file_path() . self::get_rel_path( $rel_path );
|
||||
}
|
||||
|
||||
public static function include_isolated( $path ) {
|
||||
call_user_func( self::$include_isolated_callable, $path );
|
||||
}
|
||||
|
||||
public static function include_child_first( $rel_path ) {
|
||||
if ( is_child_theme() ) {
|
||||
$path = self::get_child_path( $rel_path );
|
||||
|
||||
if ( file_exists( $path ) ) {
|
||||
self::include_isolated( $path );
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
$path = self::get_parent_path( $rel_path );
|
||||
|
||||
if ( file_exists( $path ) ) {
|
||||
self::include_isolated( $path );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public static function _action_enqueue_scripts() {
|
||||
self::include_child_first( '/static.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public static function _action_init() {
|
||||
self::include_child_first( '/menus.php' );
|
||||
self::include_child_first( '/posts.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public static function _action_widgets_init() {
|
||||
{
|
||||
$paths = array();
|
||||
|
||||
if ( is_child_theme() ) {
|
||||
$paths[] = self::get_child_path( '/widgets' );
|
||||
}
|
||||
|
||||
$paths[] = self::get_parent_path( '/widgets' );
|
||||
}
|
||||
|
||||
$included_widgets = array();
|
||||
|
||||
foreach ( $paths as $path ) {
|
||||
|
||||
//all available theme widgets directories:
|
||||
//autoloading removed
|
||||
$dirs = array(
|
||||
'about',
|
||||
'banner',
|
||||
'contacts',
|
||||
'facebook-page-stream',
|
||||
'flickr',
|
||||
'post-tabs',
|
||||
'recent',
|
||||
'theme-posts',
|
||||
'twitter',
|
||||
);
|
||||
|
||||
foreach ( $dirs as $dir ) {
|
||||
// $dirname = basename( $dir );
|
||||
$dirname = $dir;
|
||||
|
||||
if ( isset( $included_widgets[ $dirname ] ) ) {
|
||||
// this happens when a widget in child theme wants to overwrite the widget from parent theme
|
||||
continue;
|
||||
} else {
|
||||
$included_widgets[ $dirname ] = true;
|
||||
}
|
||||
|
||||
$path_to_widget_class = $dir . '/class-widget-' . $dirname;
|
||||
|
||||
//checking that file exists in provided dirs
|
||||
$full_path_to_widget_class = self::$template_directory . '/inc/widgets/'. $dirname . '/class-widget-' . $dirname . '.php';
|
||||
if ( file_exists( $full_path_to_widget_class ) ) {
|
||||
self::include_isolated( $full_path_to_widget_class );
|
||||
|
||||
$widget_class = 'Solarify_Widget_' . self::dirname_to_classname( $dirname );
|
||||
if ( class_exists( $widget_class ) ) {
|
||||
register_widget( $widget_class );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Solarify_Theme_Includes::init();
|
||||
11
wp-content/themes/solarify/inc/menus.php
Normal file
11
wp-content/themes/solarify/inc/menus.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
/**
|
||||
* Register menus
|
||||
*/
|
||||
|
||||
// This theme uses wp_nav_menu() in following locations:
|
||||
register_nav_menus( array(
|
||||
'primary' => esc_html__( 'Top primary menu', 'solarify' ),
|
||||
) );
|
||||
BIN
wp-content/themes/solarify/inc/plugins/mwt-addons.zip
Normal file
BIN
wp-content/themes/solarify/inc/plugins/mwt-addons.zip
Normal file
Binary file not shown.
BIN
wp-content/themes/solarify/inc/plugins/mwt-unyson-extensions.zip
Normal file
BIN
wp-content/themes/solarify/inc/plugins/mwt-unyson-extensions.zip
Normal file
Binary file not shown.
174
wp-content/themes/solarify/inc/static.php
Normal file
174
wp-content/themes/solarify/inc/static.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
/**
|
||||
* Include static files: javascript and css
|
||||
*/
|
||||
|
||||
//removing default font awesome css style - we using our "fonts.css" file which contain font awesome
|
||||
wp_deregister_style( 'fw-font-awesome' );
|
||||
|
||||
//Add Theme Fonts
|
||||
wp_enqueue_style(
|
||||
'solarify-icon-fonts',
|
||||
SOLARIFY_THEME_URI . '/css/fonts.css',
|
||||
array(),
|
||||
SOLARIFY_THEME_VERSION
|
||||
);
|
||||
|
||||
if ( is_admin_bar_showing() ) {
|
||||
//Add Frontend admin styles
|
||||
wp_register_style(
|
||||
'solarify-admin_bar',
|
||||
SOLARIFY_THEME_URI . '/css/admin-frontend.css',
|
||||
array(),
|
||||
SOLARIFY_THEME_VERSION
|
||||
);
|
||||
wp_enqueue_style( 'solarify-admin_bar' );
|
||||
}
|
||||
|
||||
//styles and scripts below only for frontend: if in dashboard - exit
|
||||
if ( is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts and styles for the front end.
|
||||
*/
|
||||
// Add theme google font, used in the main stylesheet.
|
||||
wp_enqueue_style(
|
||||
'solarify-font',
|
||||
solarify_google_font_url(),
|
||||
array(),
|
||||
SOLARIFY_THEME_VERSION
|
||||
);
|
||||
|
||||
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||
wp_enqueue_script( 'comment-reply' );
|
||||
}
|
||||
|
||||
if ( is_singular() && wp_attachment_is_image() ) {
|
||||
wp_enqueue_script(
|
||||
'solarify-keyboard-image-navigation',
|
||||
SOLARIFY_THEME_URI . '/js/keyboard-image-navigation.js',
|
||||
array( 'jquery' ),
|
||||
SOLARIFY_THEME_VERSION
|
||||
);
|
||||
}
|
||||
|
||||
//plugins theme script
|
||||
wp_enqueue_script(
|
||||
'solarify-modernizr',
|
||||
SOLARIFY_THEME_URI . '/js/vendor/modernizr-2.6.2.min.js',
|
||||
false,
|
||||
'2.6.2',
|
||||
false
|
||||
);
|
||||
|
||||
//plugins theme script
|
||||
wp_enqueue_script(
|
||||
'solarify-compressed',
|
||||
SOLARIFY_THEME_URI . '/js/compressed.js',
|
||||
array( 'jquery' ),
|
||||
SOLARIFY_THEME_VERSION,
|
||||
true
|
||||
);
|
||||
//custom plugins theme script
|
||||
wp_enqueue_script(
|
||||
'solarify-plugins',
|
||||
SOLARIFY_THEME_URI . '/js/plugins.js',
|
||||
array( 'jquery' ),
|
||||
SOLARIFY_THEME_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
//getting theme color scheme number
|
||||
$color_scheme_number = function_exists( 'fw_get_db_customizer_option' ) ? fw_get_db_customizer_option( 'color_scheme_number' ) : '';
|
||||
|
||||
//if WooCommerce - remove prettyPhoto - we have one in "compressed.js"
|
||||
if ( class_exists( 'WooCommerce' ) ) :
|
||||
wp_dequeue_script( 'prettyPhoto' );
|
||||
wp_dequeue_script( 'prettyPhoto-init' );
|
||||
wp_deregister_style( 'woocommerce_prettyPhoto_css' );
|
||||
|
||||
// Add Theme Woo Styles and Scripts
|
||||
wp_enqueue_style(
|
||||
'social-activism-woo',
|
||||
SOLARIFY_THEME_URI . '/css/woo' . esc_attr( $color_scheme_number ) . '.css',
|
||||
array(),
|
||||
SOLARIFY_THEME_VERSION
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'social-activism-woo',
|
||||
SOLARIFY_THEME_URI . '/js/woo.js',
|
||||
array( 'jquery' ),
|
||||
SOLARIFY_THEME_VERSION,
|
||||
true
|
||||
);
|
||||
endif; //WooCommerce
|
||||
|
||||
//main theme script
|
||||
wp_enqueue_script(
|
||||
'solarify-main',
|
||||
SOLARIFY_THEME_URI . '/js/main.js',
|
||||
array( 'jquery' ),
|
||||
SOLARIFY_THEME_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script('solarify-main', 'WPURLS', array( 'siteurl' => get_option('siteurl') ));
|
||||
|
||||
//if AccessPress is active
|
||||
if ( class_exists( 'SC_Class' ) ) :
|
||||
wp_deregister_style( 'fontawesome-css' );
|
||||
wp_deregister_style( 'apsc-frontend-css' );
|
||||
wp_enqueue_style(
|
||||
'solarify-accesspress',
|
||||
SOLARIFY_THEME_URI . '/css/accesspress.css',
|
||||
array(),
|
||||
SOLARIFY_THEME_VERSION
|
||||
);
|
||||
endif; //AccessPress
|
||||
|
||||
//Add Theme Booked Styles
|
||||
if( class_exists('booked_plugin')) {
|
||||
wp_dequeue_style('booked-styles');
|
||||
wp_dequeue_style('booked-responsive');
|
||||
wp_enqueue_style(
|
||||
'solarify-booked',
|
||||
SOLARIFY_THEME_URI . '/css/booked' . esc_attr( $color_scheme_number ) . '.css',
|
||||
array(),
|
||||
'1.0.1'
|
||||
);
|
||||
}//Booked
|
||||
|
||||
|
||||
// Add Theme stylesheet.
|
||||
wp_enqueue_style( 'solarify-css-style', get_stylesheet_uri() );
|
||||
|
||||
// Add Bootstrap Style
|
||||
wp_enqueue_style(
|
||||
'bootstrap',
|
||||
SOLARIFY_THEME_URI . '/css/bootstrap.min.css',
|
||||
array(),
|
||||
SOLARIFY_THEME_VERSION
|
||||
);
|
||||
|
||||
// Add Animations Style
|
||||
wp_enqueue_style(
|
||||
'solarify-animations',
|
||||
SOLARIFY_THEME_URI . '/css/animations.css',
|
||||
array(),
|
||||
SOLARIFY_THEME_VERSION
|
||||
);
|
||||
|
||||
// Add Theme Style
|
||||
wp_enqueue_style(
|
||||
'solarify-main',
|
||||
SOLARIFY_THEME_URI . '/css/main' . esc_attr( $color_scheme_number ) . '.css',
|
||||
array(),
|
||||
SOLARIFY_THEME_VERSION
|
||||
);
|
||||
wp_add_inline_style( 'solarify-main', solarify_add_font_styles_in_head() );
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
if ( class_exists( 'Solarify_Comments_Walker' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Walker for comments
|
||||
*/
|
||||
class Solarify_Comments_Walker extends Walker_Comment {
|
||||
|
||||
/**
|
||||
* Output a comment in the HTML5 format.
|
||||
* @see wp_list_comments()
|
||||
*
|
||||
* @param object $comment Comment to display.
|
||||
* @param int $depth Depth of comment.
|
||||
* @param array $args An array of arguments.
|
||||
*/
|
||||
protected function html5_comment( $comment, $depth, $args ) {
|
||||
$tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
|
||||
?>
|
||||
<<?php echo esc_html( $tag ); ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?>>
|
||||
<article id="div-comment-<?php comment_ID(); ?>" class="comment">
|
||||
<div class="comment-author vcard">
|
||||
<?php if ( 0 != $args['avatar_size'] ) {
|
||||
echo get_avatar( $comment, $args['avatar_size'], '', '', array( 'class' => 'media-object' ) );
|
||||
} ?>
|
||||
</div>
|
||||
<!-- .comment-author -->
|
||||
|
||||
<div class="comment-body">
|
||||
<footer class="comment-meta">
|
||||
|
||||
<div class="author_url darklinks"><?php printf( '%s <span class="says">' . '</span>', sprintf( '<span class="fn">%s</span>', get_comment_author_link( $comment ) ) ); ?></div>
|
||||
<div class="comment-date highlight">
|
||||
|
||||
<time datetime="<?php comment_time( 'c' ); ?>">
|
||||
<?php
|
||||
/* translators: 1: comment date, 2: comment time */
|
||||
printf( esc_html__( '%1$s at %2$s', 'solarify' ), get_comment_date( 'Y.m.d', $comment ), get_comment_time() );
|
||||
?>
|
||||
</time>
|
||||
|
||||
</div><!-- .comment-metadata -->
|
||||
|
||||
<?php if ( '0' == $comment->comment_approved ) : ?>
|
||||
<p class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'solarify' ); ?></p>
|
||||
<?php endif; ?>
|
||||
</footer><!-- .comment-meta -->
|
||||
|
||||
<div class="comment-content">
|
||||
<?php comment_text(); ?>
|
||||
</div><!-- .comment-content -->
|
||||
|
||||
<?php
|
||||
comment_reply_link( array_merge( $args, array(
|
||||
'add_below' => 'div-comment',
|
||||
'depth' => $depth,
|
||||
'reply_text' => '<i class="fa fa-reply"></i>',
|
||||
'max_depth' => $args['max_depth'],
|
||||
'before' => '<span class="reply">',
|
||||
'after' => '</span>'
|
||||
) ) );
|
||||
?>
|
||||
</div><!-- .media-left -->
|
||||
</article><!-- .comment-body -->
|
||||
<?php
|
||||
}
|
||||
}
|
||||
1483
wp-content/themes/solarify/inc/sub-includes/icons-rt.php
Normal file
1483
wp-content/themes/solarify/inc/sub-includes/icons-rt.php
Normal file
File diff suppressed because it is too large
Load Diff
204
wp-content/themes/solarify/inc/sub-includes/icons-social.php
Normal file
204
wp-content/themes/solarify/inc/sub-includes/icons-social.php
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
function solarify_filter_social_icons_icon_set( $sets ) {
|
||||
$sets['social-icons'] = array(
|
||||
'font-style-src' => SOLARIFY_THEME_URI . ( '/css/fonts.css' ),
|
||||
'container-class' => '', // some fonts need special wrapper class to display properly
|
||||
'groups' => array(
|
||||
'all' => esc_html__( 'All', 'solarify' ),
|
||||
),
|
||||
'icons' => array(
|
||||
'social-icon socicon-augment' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-bitbucket' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-fyuse' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-yt-gaming' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-sketchfab' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-mobcrush' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-microsoft' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-pandora' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-messenger' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-gamewisp' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-bloglovin' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-tunein' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-gamejolt' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-trello' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-spreadshirt' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-500px' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-8tracks' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-airbnb' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-alliance' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-amazon' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-amplement' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-android' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-angellist' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-apple' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-appnet' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-baidu' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-bandcamp' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-battlenet' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-mixer' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-bebee' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-bebo' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-behance' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-blizzard' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-blogger' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-buffer' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-chrome' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-coderwall' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-curse' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-dailymotion' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-deezer' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-delicious' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-deviantart' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-diablo' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-digg' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-discord' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-disqus' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-douban' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-draugiem' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-dribbble' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-drupal' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-ebay' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-ello' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-endomodo' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-envato' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-etsy' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-facebook' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-feedburner' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-filmweb' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-firefox' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-flattr' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-flickr' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-formulr' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-forrst' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-foursquare' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-friendfeed' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-github' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-goodreads' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-google' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-googlescholar' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-googlegroups' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-googlephotos' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-googleplus' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-grooveshark' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-hackerrank' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-hearthstone' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-hellocoton' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-heroes' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-hitbox' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-horde' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-houzz' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-icq' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-identica' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-imdb' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-instagram' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-issuu' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-istock' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-itunes' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-keybase' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-lanyrd' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-lastfm' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-line' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-linkedin' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-livejournal' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-lyft' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-macos' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-mail' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-medium' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-meetup' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-mixcloud' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-modelmayhem' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-mumble' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-myspace' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-newsvine' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-nintendo' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-npm' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-odnoklassniki' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-openid' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-opera' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-outlook' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-overwatch' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-patreon' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-paypal' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-periscope' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-persona' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-pinterest' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-play' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-player' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-playstation' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-pocket' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-qq' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-quora' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-raidcall' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-ravelry' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-reddit' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-renren' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-researchgate' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-residentadvisor' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-reverbnation' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-rss' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-sharethis' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-skype' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-slideshare' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-smugmug' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-snapchat' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-songkick' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-soundcloud' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-spotify' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-stackexchange' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-stackoverflow' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-starcraft' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-stayfriends' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-steam' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-storehouse' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-strava' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-streamjar' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-stumbleupon' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-swarm' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-teamspeak' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-teamviewer' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-technorati' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-telegram' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-tripadvisor' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-tripit' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-triplej' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-tumblr' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-twitch' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-twitter' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-uber' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-ventrilo' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-viadeo' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-viber' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-viewbug' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-vimeo' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-vine' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-vkontakte' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-warcraft' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-wechat' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-weibo' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-whatsapp' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-wikipedia' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-wordpress' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-windows' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-wykop' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-xbox' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-xing' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-yahoo' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-yammer' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-yandex' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-yelp' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-younow' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-zynga' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-youtube' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-zapier' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-zerply' => array( 'group' => 'all' ),
|
||||
'social-icon socicon-zomato' => array( 'group' => 'all' ),
|
||||
),
|
||||
);
|
||||
|
||||
return $sets;
|
||||
}
|
||||
|
||||
add_filter( 'fw_option_type_icon_sets', 'solarify_filter_social_icons_icon_set' );
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'solarify_post_like_button' ) ) :
|
||||
/**
|
||||
* Print like button
|
||||
*/
|
||||
function solarify_post_like_button( $postID ) {
|
||||
if ( function_exists( 'mwt_post_like_button' ) ) {
|
||||
mwt_post_like_button( $postID );
|
||||
}
|
||||
} //solarify_post_like_button()
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'solarify_post_like_count' ) ) :
|
||||
/**
|
||||
* Print like counter value
|
||||
*/
|
||||
function solarify_post_like_count( $postID ) {
|
||||
if ( function_exists( 'mwt_post_like_count' ) ) {
|
||||
mwt_post_like_count( $postID );
|
||||
}
|
||||
|
||||
} //solarify_post_like_count()
|
||||
endif;
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'solarify_show_post_views_count' ) ) :
|
||||
function solarify_show_post_views_count() {
|
||||
if ( function_exists( 'mwt_show_post_views_count' ) ) {
|
||||
mwt_show_post_views_count();
|
||||
}
|
||||
} //solarify_show_post_views_count()
|
||||
endif;
|
||||
203
wp-content/themes/solarify/inc/sub-includes/mod-widget-adds.php
Normal file
203
wp-content/themes/solarify/inc/sub-includes/mod-widget-adds.php
Normal file
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
//additional fields to widgets
|
||||
if (!function_exists('solarify_action_in_widget_form') ) :
|
||||
function solarify_action_in_widget_form( $t, $return, $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '', 'float' => 'none' ) );
|
||||
if ( ! isset( $instance['widget_background'] ) ) {
|
||||
$instance['widget_background'] = null;
|
||||
}
|
||||
|
||||
if ( ! isset( $instance['bootstrap_width'] ) ) {
|
||||
$instance['bootstrap_width'] = null;
|
||||
}
|
||||
|
||||
if ( ! isset( $instance['text_align'] ) ) {
|
||||
$instance['text_align'] = null;
|
||||
}
|
||||
|
||||
if ( isset( $instance[ 'bootstrap_custom_width' ] ) ) {
|
||||
$custom_width = $instance[ 'bootstrap_custom_width' ];
|
||||
} else {
|
||||
$custom_width = '';
|
||||
}
|
||||
?>
|
||||
<p class="widget_background_option">
|
||||
<label for="<?php echo esc_attr( $t->get_field_id( 'widget_background' ) ); ?>"><?php esc_html_e( 'Widget Background:', 'solarify' ); ?></label>
|
||||
<select id="<?php echo esc_attr( $t->get_field_id( 'widget_background' ) ); ?>"
|
||||
name="<?php echo esc_attr( $t->get_field_name( 'widget_background' ) ); ?>">
|
||||
<option <?php selected( $instance['widget_background'], '' ); ?>
|
||||
value=""><?php esc_html_e( 'None', 'solarify' ); ?></option>
|
||||
<option
|
||||
<?php selected( $instance['widget_background'], 'with_background with_padding big-padding' ); ?>value="with_background with_padding big-padding"><?php esc_html_e( 'Light Backgorund', 'solarify' ); ?></option>
|
||||
<option
|
||||
<?php selected( $instance['widget_background'], 'muted_background with_padding big-padding' ); ?>value="muted_background with_padding big-padding"><?php esc_html_e( 'Muted Backgorund', 'solarify' ); ?></option>
|
||||
<option <?php selected( $instance['widget_background'], 'ds ms with_padding big-padding' ); ?>
|
||||
value="ds ms with_padding big-padding"><?php esc_html_e( 'Dark Background', 'solarify' ); ?></option>
|
||||
<option <?php selected( $instance['widget_background'], 'gradient_bg with_padding big-padding' ); ?>
|
||||
value="gradient_bg with_padding big-padding"><?php esc_html_e( 'Gradient Background', 'solarify' ); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
<p class="widget_bootstrap_width">
|
||||
<label
|
||||
for="<?php echo esc_attr( $t->get_field_id( 'bootstrap_width' ) ); ?>"><?php esc_html_e( 'Widget Column Width:', 'solarify' ); ?>
|
||||
</label>
|
||||
<select id="<?php echo esc_attr( $t->get_field_id( 'bootstrap_width' ) ); ?>"
|
||||
name="<?php echo esc_attr( $t->get_field_name( 'bootstrap_width' ) ); ?>">
|
||||
<option <?php selected( $instance['bootstrap_width'], '' ); ?> value=""><?php esc_html_e( 'None', 'solarify' ); ?></option>
|
||||
<option <?php selected( $instance['bootstrap_width'], 'col-md-3 col-sm-6' ); ?>value="col-md-3 col-sm-6">1/4</option>
|
||||
<option <?php selected( $instance['bootstrap_width'], 'col-md-4 col-sm-6' ); ?> value="col-md-4 col-sm-6">1/3</option>
|
||||
<option <?php selected( $instance['bootstrap_width'], 'col-sm-6' ); ?> value="col-sm-6">1/2</option>
|
||||
<option <?php selected( $instance['bootstrap_width'], 'col-sm-12' ); ?>value="col-sm-12"><?php esc_html_e( 'Full Width', 'solarify' ); ?></option>
|
||||
<option <?php selected( $instance['bootstrap_width'], 'previous-column' ); ?>value="previous-column"><?php esc_html_e( 'Put in previous widget column', 'solarify' ); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
<p class="widget_bootstrap_custom_width">
|
||||
<label
|
||||
for="<?php echo esc_attr( $t->get_field_id( 'bootstrap_custom_width' ) ); ?>"><?php esc_html_e( 'Custom Column Width:', 'solarify' ); ?>
|
||||
</label>
|
||||
<input type="text" id="<?php echo esc_attr( $t->get_field_id( 'bootstrap_custom_width' ) ); ?>"
|
||||
name="<?php echo esc_attr( $t->get_field_name( 'bootstrap_custom_width' ) ); ?>" value="<?php echo esc_attr( $custom_width ); ?>" >
|
||||
</input><br>
|
||||
<?php echo esc_html__( 'Use bootstrap grid classes or left it empty.', 'solarify' ); ?>
|
||||
</p>
|
||||
<p class="widget_text_align">
|
||||
<label
|
||||
for="<?php echo esc_attr( $t->get_field_id( 'text_align' ) ); ?>"><?php esc_html_e( 'Widget Text Align:', 'solarify' ); ?>
|
||||
</label>
|
||||
<select id="<?php echo esc_attr( $t->get_field_id( 'text_align' ) ); ?>"
|
||||
name="<?php echo esc_attr( $t->get_field_name( 'text_align' ) ); ?>">
|
||||
<option <?php selected( $instance['text_align'], '' ); ?> value=""><?php esc_html_e( 'Left', 'solarify' ); ?></option>
|
||||
<option <?php selected( $instance['text_align'], 'text-center' ); ?>value="text-center"><?php esc_html_e( 'Center', 'solarify' ); ?></option>
|
||||
<option <?php selected( $instance['text_align'], 'text-right' ); ?> value="text-right"><?php esc_html_e( 'Right', 'solarify' ); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
$return = null;
|
||||
|
||||
return array( $t, $return, $instance );
|
||||
} //solarify_action_in_widget_form()
|
||||
endif;
|
||||
|
||||
if( !function_exists('solarify_filter_in_widget_form_update') ) :
|
||||
function solarify_filter_in_widget_form_update( $instance, $new_instance, $old_instance ) {
|
||||
$instance['widget_background'] = $new_instance['widget_background'];
|
||||
$instance['bootstrap_width'] = $new_instance['bootstrap_width'];
|
||||
$instance['bootstrap_custom_width'] = $new_instance['bootstrap_custom_width'];
|
||||
$instance['text_align'] = $new_instance['text_align'];
|
||||
|
||||
return $instance;
|
||||
} //solarify_filter_in_widget_form_update()
|
||||
endif;
|
||||
|
||||
if( !function_exists( 'solarify_filter_dynamic_sidebar_params' ) ):
|
||||
function solarify_filter_dynamic_sidebar_params( $params ) {
|
||||
|
||||
//only for frontend
|
||||
if ( is_admin() ) {
|
||||
return $params;
|
||||
}
|
||||
global $wp_registered_widgets;
|
||||
|
||||
//widget options
|
||||
$widget_id = $params[0]['widget_id'];
|
||||
$widget_obj = $wp_registered_widgets[ $widget_id ];
|
||||
$widget_opt = get_option( $widget_obj['callback'][0]->option_name );
|
||||
$widget_num = $widget_obj['params'][0]['number'];
|
||||
|
||||
//arrays with widgets that needs to modify they CSS classes
|
||||
$darklinks_widgets = array(
|
||||
'widget_recent_comments',
|
||||
);
|
||||
|
||||
$greylinks_widgets = array(
|
||||
'widget_pages',
|
||||
'widget_nav_menu',
|
||||
'widget_meta',
|
||||
'widget_categories',
|
||||
'widget_archive',
|
||||
'widget_recent_posts'
|
||||
);
|
||||
|
||||
$background_widgets = array();
|
||||
|
||||
if ( in_array( $wp_registered_widgets[ $widget_id ]['classname'], $darklinks_widgets ) ) {
|
||||
$params[0]['before_widget'] = str_replace( 'class="widget ', 'class="darklinks widget ', $params[0]['before_widget'] );
|
||||
}
|
||||
|
||||
if ( in_array( $wp_registered_widgets[ $widget_id ]['classname'], $greylinks_widgets ) ) {
|
||||
$params[0]['before_widget'] = str_replace( 'class="widget ', 'class="greylinks widget ', $params[0]['before_widget'] );
|
||||
}
|
||||
|
||||
if ( in_array( $wp_registered_widgets[ $widget_id ]['classname'], $background_widgets ) ) {
|
||||
$params[0]['before_widget'] = str_replace( 'class="widget ', 'class="with_background widget ', $params[0]['before_widget'] );
|
||||
}
|
||||
|
||||
if ( is_active_widget( false, false, 'monster' ) ) {
|
||||
|
||||
foreach ( $wp_registered_widgets as $key => $widget_instance ) {
|
||||
|
||||
//working inside monster but not outside
|
||||
if ( is_active_widget( false, false, 'monster' ) ) {
|
||||
if ( in_array( $widget_instance['callback'][0]->widget_options['classname'], $darklinks_widgets ) ) {
|
||||
$widget_instance['callback'][0]->widget_options['classname'] .= ' darklinks';
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( in_array( $widget_instance['callback'][0]->widget_options['classname'], $greylinks_widgets ) ) {
|
||||
$widget_instance['callback'][0]->widget_options['classname'] .= ' greylinks';
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( in_array( $wp_registered_widgets[ $key ]['classname'], $background_widgets ) ) {
|
||||
$widget_instance['callback'][0]->widget_options['classname'] .= ' with_background';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
} //foreach
|
||||
} //if monster widget
|
||||
|
||||
$widget_background = ( !empty( $widget_opt[ $widget_num ]['widget_background'] ) ) ? $widget_opt[ $widget_num ]['widget_background'] : 'widget_no_background';
|
||||
$bootstrap_width = ( !empty( $widget_opt[ $widget_num ]['bootstrap_width'] ) ) ? $widget_opt[ $widget_num ]['bootstrap_width'] : '';
|
||||
$bootstrap_custom_width = ( !empty( $widget_opt[ $widget_num ]['bootstrap_custom_width'] ) ) ? $widget_opt[ $widget_num ]['bootstrap_custom_width'] : '';
|
||||
$text_align = ( !empty( $widget_opt[ $widget_num ]['text_align'] ) ) ? $widget_opt[ $widget_num ]['text_align'] : '';
|
||||
|
||||
//creating columns only in footer widget area
|
||||
if ( $bootstrap_width == 'none' || ( $params[0]['id'] !== 'sidebar-footer' && $params[0]['id'] !== 'sidebar-footer-secondary' ) ) {
|
||||
$bootstrap_width = '';
|
||||
}
|
||||
//if no width set in footer sidebar - set width to 'col-sm-12'
|
||||
if ( ( $bootstrap_width == 'none' || ! $bootstrap_width ) && $params[0]['id'] == 'sidebar-footer' ) {
|
||||
$bootstrap_width = 'col-sm-12';
|
||||
}
|
||||
//if custom width set
|
||||
if ( !empty( $bootstrap_custom_width ) ) {
|
||||
$bootstrap_width = $bootstrap_custom_width;
|
||||
}
|
||||
|
||||
$params[0]['before_widget'] = '<div class="widget-theme-wrapper ' . esc_attr( $widget_background ) . ' ' . esc_attr( $text_align ) . '">' . $params[0]['before_widget'];
|
||||
$params[0]['after_widget'] = $params[0]['after_widget'] . '</div>';
|
||||
|
||||
if ( $bootstrap_width ) {
|
||||
$params[0]['before_widget'] = '<div class="' . esc_attr( $bootstrap_width ) . '">' . $params[0]['before_widget'];
|
||||
$params[0]['after_widget'] = $params[0]['after_widget'] . '</div>';
|
||||
}
|
||||
|
||||
return $params;
|
||||
} //solarify_filter_dynamic_sidebar_params()
|
||||
endif;
|
||||
|
||||
//Add input fields(priority 5, 3 parameters)
|
||||
add_action( 'in_widget_form', 'solarify_action_in_widget_form', 5, 3 );
|
||||
//Callback function for options update (priority 5, 3 parameters)
|
||||
add_filter( 'widget_update_callback', 'solarify_filter_in_widget_form_update', 5, 3 );
|
||||
//add class names (default priority, one parameter)
|
||||
add_filter( 'dynamic_sidebar_params', 'solarify_filter_dynamic_sidebar_params', 1 );
|
||||
|
||||
//eof widgets additional fields
|
||||
@@ -0,0 +1,52 @@
|
||||
jQuery(document).ready(function($) {
|
||||
"use strict";
|
||||
//like button
|
||||
jQuery("a.like_button").click(function(e){
|
||||
e.preventDefault();
|
||||
var $this = jQuery(this);
|
||||
if(!$this.hasClass('like_active_button')) {
|
||||
//return;
|
||||
}
|
||||
var $parent = $this.parent();
|
||||
var id = $parent.data('id'),
|
||||
data = {
|
||||
action: 'add_like',
|
||||
security : MyAjax.security,
|
||||
pID: id
|
||||
};
|
||||
|
||||
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
||||
var post_result = $.post(MyAjax.ajaxurl, data, function(response) {
|
||||
$parent.html('<span class="like_button highlight2"><i class="rt-icon2-checkmark2"></i></span>');
|
||||
jQuery('.votes_count_'+id).html(response);
|
||||
}).done(function() {
|
||||
|
||||
}).fail(function(xhr, textStatus, errorThrown) {
|
||||
console.log(xhr.responseText);
|
||||
}).always(function() {
|
||||
});
|
||||
|
||||
});
|
||||
//$(".like_button").click(function(e){
|
||||
// var id = $(this).parent().data('id'),
|
||||
// data = {
|
||||
// action: 'add_like',
|
||||
// security : MyAjax.security,
|
||||
// pID: id
|
||||
// },
|
||||
// parent = $(this).parent();
|
||||
//
|
||||
// // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
||||
// var post_result = $.post(MyAjax.ajaxurl, data, function(response) {
|
||||
// parent.html('<i class="rt-icon icon-heart3"></i>');
|
||||
// $('.votes_count_'+id).html(response);
|
||||
// }).done(function() {
|
||||
//
|
||||
// }).fail(function(xhr, textStatus, errorThrown) {
|
||||
// console.log(xhr.responseText);
|
||||
// }).always(function() {
|
||||
// });
|
||||
//
|
||||
// e.preventDefault();
|
||||
//});
|
||||
});
|
||||
269
wp-content/themes/solarify/inc/sub-includes/woocommerce.php
Normal file
269
wp-content/themes/solarify/inc/sub-includes/woocommerce.php
Normal file
@@ -0,0 +1,269 @@
|
||||
<?php
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
|
||||
//remove page title in shop page
|
||||
add_filter( 'woocommerce_show_page_title', 'solarify_filter_remove_shop_title_in_content' );
|
||||
if ( ! function_exists( 'solarify_filter_remove_shop_title_in_content' ) ) :
|
||||
function solarify_filter_remove_shop_title_in_content() {
|
||||
return false;
|
||||
}
|
||||
endif;
|
||||
|
||||
//remove wrappers
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
|
||||
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
|
||||
|
||||
//wrap in col-sm- and .columns-2 all products on shop page
|
||||
add_action( 'woocommerce_before_shop_loop', 'solarify_action_echo_div_wraps_before_shop_loop' );
|
||||
if ( ! function_exists( 'solarify_action_echo_div_wraps_before_shop_loop' ) ) :
|
||||
function solarify_action_echo_div_wraps_before_shop_loop() {
|
||||
$column_classes = solarify_get_columns_classes();
|
||||
$columns_amount = ( $column_classes[ 'main_column_class' ] === 'col-xs-12' ) ? 3 : 2;
|
||||
if ( function_exists( 'wc_get_loop_prop' ) ) {
|
||||
$columns_amount = wc_get_loop_prop( 'columns' );
|
||||
if ( $column_classes[ 'main_column_class' ] === 'col-xs-12' && $columns_amount > 4 ) {
|
||||
$columns_amount = 4;
|
||||
} else if ( $column_classes[ 'main_column_class' ] !== 'col-xs-12' && $columns_amount > 3 ) {
|
||||
$columns_amount = 3;
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div id="content_products" class="' . esc_attr( $column_classes[ 'main_column_class' ] ) . '">';
|
||||
echo '<div class="columns-' . $columns_amount . '">';
|
||||
echo '<div class="form-inline content-justify vertical-center">';
|
||||
}
|
||||
endif;
|
||||
|
||||
//before shop loop - removing breadcrumbs and results count
|
||||
remove_filter( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
|
||||
remove_filter( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
|
||||
//wrapping sort form in div and adding view toggle button
|
||||
add_action( 'woocommerce_before_shop_loop', 'solarify_action_before_shop_loop_wrap_form', 15 );
|
||||
if ( ! function_exists( 'solarify_action_before_shop_loop_wrap_form' ) ) :
|
||||
function solarify_action_before_shop_loop_wrap_form() {
|
||||
echo '<div class="storefront-sorting">';
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'solarify_action_before_shop_loop_wrap_form_close_first' ) ) :
|
||||
function solarify_action_before_shop_loop_wrap_form_close_first() {
|
||||
woocommerce_result_count();
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_before_shop_loop', 'solarify_action_before_shop_loop_wrap_form_close_first', 10 );
|
||||
|
||||
if ( ! function_exists( 'solarify_action_before_shop_loop_wrap_form_close_second' ) ) :
|
||||
function solarify_action_before_shop_loop_wrap_form_close_second() {
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_before_shop_loop', 'solarify_action_before_shop_loop_wrap_form_close_second', 40 );
|
||||
|
||||
//start loop - adding classes to products ul
|
||||
if ( ! function_exists( 'woocommerce_product_loop_start' ) ) :
|
||||
function woocommerce_product_loop_start( $echo = true ) {
|
||||
//id products is necessary for scripts
|
||||
|
||||
$html = '<ul class="products list-unstyled">';
|
||||
$GLOBALS[ 'woocommerce_loop' ][ 'loop' ] = 0;
|
||||
if ( $echo ) {
|
||||
echo wp_kses_post( $html );
|
||||
} else {
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
//loop pagination
|
||||
//closing main column and getting sidebar if exist
|
||||
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination' );
|
||||
add_action( 'woocommerce_after_shop_loop', 'solarify_action_echo_div_columns_after_shop_loop' );
|
||||
if ( ! function_exists( 'solarify_action_echo_div_columns_after_shop_loop' ) ):
|
||||
function solarify_action_echo_div_columns_after_shop_loop() {
|
||||
echo '</div><!-- eof .columns-2 -->';
|
||||
$pagination_html = solarify_bootstrap_paginate_links();
|
||||
if ( $pagination_html ) {
|
||||
echo '<div class="text-center">';
|
||||
echo wp_kses_post( $pagination_html );
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div><!-- eof #content_products -->';
|
||||
$column_classes = solarify_get_columns_classes();
|
||||
if ( $column_classes[ 'sidebar_class' ] ): ?>
|
||||
<!-- main aside sidebar -->
|
||||
<aside class="<?php echo esc_attr( $column_classes[ 'sidebar_class' ] ); ?>">
|
||||
<?php get_sidebar(); ?>
|
||||
</aside>
|
||||
<!-- eof main aside sidebar -->
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
endif;
|
||||
|
||||
// single product in shop loop
|
||||
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
|
||||
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
|
||||
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
|
||||
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
|
||||
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
|
||||
//start of loop item
|
||||
add_action( 'woocommerce_before_shop_loop_item', 'solarify_action_echo_markup_before_shop_loop_item' );
|
||||
if ( ! function_exists( 'solarify_action_echo_markup_before_shop_loop_item' ) ):
|
||||
function solarify_action_echo_markup_before_shop_loop_item() {
|
||||
echo '<div class="vertical-item content-padding with_background">';
|
||||
echo '<div class="item-media">';
|
||||
|
||||
woocommerce_template_loop_product_link_open();
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_before_shop_loop_item_title', 'solarify_action_echo_markup_before_shop_loop_item_title' );
|
||||
if ( ! function_exists( 'solarify_action_echo_markup_before_shop_loop_item_title' ) ):
|
||||
function solarify_action_echo_markup_before_shop_loop_item_title() {
|
||||
woocommerce_template_loop_product_link_close();
|
||||
echo '</div> <!-- eof .item-media -->';
|
||||
echo '<div class="item-content">';
|
||||
|
||||
woocommerce_template_loop_product_link_open();
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_after_shop_loop_item_title', 'solarify_action_echo_markup_after_shop_loop_item_title' );
|
||||
if ( ! function_exists( 'solarify_action_echo_markup_after_shop_loop_item_title' ) ):
|
||||
function solarify_action_echo_markup_after_shop_loop_item_title() {
|
||||
woocommerce_template_loop_product_link_close();
|
||||
|
||||
woocommerce_template_loop_price();
|
||||
|
||||
woocommerce_template_loop_add_to_cart( array( 'class' => 'theme_button color4' ) );
|
||||
}
|
||||
endif;
|
||||
|
||||
//end of loop item
|
||||
add_action( 'woocommerce_after_shop_loop_item', 'solarify_action_echo_markup_after_shop_loop_item' );
|
||||
if ( ! function_exists( 'solarify_action_echo_markup_after_shop_loop_item' ) ):
|
||||
function solarify_action_echo_markup_after_shop_loop_item() {
|
||||
echo '</div> <!-- eof .item-content -->';
|
||||
echo '</div> <!-- eof .vertical-item -->';
|
||||
}
|
||||
endif;
|
||||
|
||||
//single product view
|
||||
//single product image and summary layout
|
||||
//wrap in col-sm- and .columns-2 all products on shop page
|
||||
add_action( 'woocommerce_before_single_product', 'solarify_action_echo_div_columns_before_single_product' );
|
||||
if ( ! function_exists( 'solarify_action_echo_div_columns_before_single_product' ) ):
|
||||
function solarify_action_echo_div_columns_before_single_product() {
|
||||
$column_classes = solarify_get_columns_classes();
|
||||
echo '<div id="content_product" class="' . esc_attr( $column_classes[ 'main_column_class' ] ) . '">';
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_after_single_product', 'solarify_action_echo_div_columns_after_single_product' );
|
||||
if ( ! function_exists( 'solarify_action_echo_div_columns_after_single_product' ) ):
|
||||
function solarify_action_echo_div_columns_after_single_product() {
|
||||
echo '</div> <!-- eof .col- -->';
|
||||
$column_classes = solarify_get_columns_classes();
|
||||
if ( $column_classes[ 'sidebar_class' ] ): ?>
|
||||
<!-- main aside sidebar -->
|
||||
<aside class="<?php echo esc_attr( $column_classes[ 'sidebar_class' ] ); ?>">
|
||||
<?php get_sidebar(); ?>
|
||||
</aside>
|
||||
<!-- eof main aside sidebar -->
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
endif;
|
||||
|
||||
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 );
|
||||
//add_action('woocommerce_product_thumbnails', 'woocommerce_show_product_sale_flash', 9 );
|
||||
add_filter( 'woocommerce_single_product_image_html', 'solarify_filter_put_onsale_span_in_main_image' );
|
||||
if ( ! function_exists( 'solarify_filter_put_onsale_span_in_main_image' ) ):
|
||||
function solarify_filter_put_onsale_span_in_main_image( $html ) {
|
||||
return $html . woocommerce_show_product_sale_flash();
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_product_thumbnails', 'solarify_action_echo_closing_div_before_single_product_thumbnails', 9 );
|
||||
if ( ! function_exists( 'solarify_action_echo_closing_div_before_single_product_thumbnails' ) ):
|
||||
function solarify_action_echo_closing_div_before_single_product_thumbnails() {
|
||||
echo '</div><!--eof .images -->';
|
||||
echo '<div class="thumbnails-wrap">';
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_before_single_product_summary', 'solarify_action_echo_div_columns_before_single_product_summary', 9 );
|
||||
if ( ! function_exists( 'solarify_action_echo_div_columns_before_single_product_summary' ) ):
|
||||
function solarify_action_echo_div_columns_before_single_product_summary() {
|
||||
echo '<div class="row">';
|
||||
echo '<div class="col-sm-6">';
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_before_single_product_summary', 'solarify_action_echo_div_close_first_column_before_single_product_summary', 21 );
|
||||
if ( ! function_exists( 'solarify_action_echo_div_close_first_column_before_single_product_summary' ) ):
|
||||
function solarify_action_echo_div_close_first_column_before_single_product_summary() {
|
||||
echo '</div><!-- eof .col-sm- with single product images -->';
|
||||
echo '<div class="col-sm-6">';
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_after_single_product_summary', 'solarify_action_echo_div_close_columns_after_single_product_summary', 9 );
|
||||
if ( ! function_exists( 'solarify_action_echo_div_close_columns_after_single_product_summary' ) ):
|
||||
function solarify_action_echo_div_close_columns_after_single_product_summary() {
|
||||
echo '</div> <!--eof .col-sm- .summary -->';
|
||||
echo '</div> <!--eof .row -->';
|
||||
}
|
||||
endif;
|
||||
|
||||
//elements in single product summary
|
||||
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
|
||||
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
|
||||
|
||||
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 15 );
|
||||
add_action( 'woocommerce_single_product_summary', 'solarify_action_echo_template_single_meta', 20 );
|
||||
if ( ! function_exists( 'solarify_action_echo_template_single_meta' ) ):
|
||||
function solarify_action_echo_template_single_meta() {
|
||||
echo '<div class="small-text weight-black greylinks">';
|
||||
woocommerce_template_single_meta();
|
||||
echo '</div>';
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_before_add_to_cart_button', 'solarify_action_echo_open_div_before_add_to_cart_button' );
|
||||
if ( ! function_exists( 'solarify_action_echo_open_div_before_add_to_cart_button' ) ):
|
||||
function solarify_action_echo_open_div_before_add_to_cart_button() {
|
||||
if ( function_exists( 'mwt_share_this' ) ) {
|
||||
solarify_share_this( true );
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_after_add_to_cart_button', 'solarify_action_echo_open_div_after_add_to_cart_button' );
|
||||
if ( ! function_exists( 'solarify_action_echo_open_div_after_add_to_cart_button' ) ):
|
||||
function solarify_action_echo_open_div_after_add_to_cart_button() {
|
||||
}
|
||||
endif;
|
||||
|
||||
//account navigation
|
||||
add_action( 'woocommerce_before_account_navigation', 'solarify_action_woocommerce_before_account_navigation' );
|
||||
if ( ! function_exists( 'solarify_action_woocommerce_before_account_navigation' ) ):
|
||||
function solarify_action_woocommerce_before_account_navigation() {
|
||||
echo '<div class="small-text darklinks">';
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'woocommerce_after_account_navigation', 'solarify_action_woocommerce_after_account_navigation' );
|
||||
if ( ! function_exists( 'solarify_action_woocommerce_after_account_navigation' ) ):
|
||||
function solarify_action_woocommerce_after_account_navigation() {
|
||||
echo '</div><!-- eof theme_buttons -->';
|
||||
}
|
||||
endif;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,86 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die();
|
||||
}
|
||||
if ( ( defined( 'FW' ) ) && ! ( class_exists( 'Solarify_Widget_About' ) ) ) :
|
||||
|
||||
class Solarify_Widget_About extends WP_Widget {
|
||||
|
||||
/**
|
||||
* Widget constructor.
|
||||
*/
|
||||
private $options;
|
||||
private $prefix;
|
||||
|
||||
function __construct() {
|
||||
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_about',
|
||||
'description' => esc_html__( 'Add company logo with description and social icons', 'solarify' ),
|
||||
);
|
||||
|
||||
parent::__construct( false, esc_html__( 'Theme - About', 'solarify' ), $widget_ops );
|
||||
|
||||
//Create our options by using Unyson option types
|
||||
$this->options = array(
|
||||
'title' => array(
|
||||
'type' => 'text',
|
||||
'label' => esc_html__( 'Widget Title', 'solarify' ),
|
||||
),
|
||||
'about' => array(
|
||||
'type' => 'wp-editor',
|
||||
'value' => '',
|
||||
'label' => esc_html__('Description', 'solarify'),
|
||||
),
|
||||
);
|
||||
$this->prefix = 'widget_about';
|
||||
}
|
||||
|
||||
function widget( $args, $instance ) {
|
||||
extract( wp_parse_args( $args ) );
|
||||
|
||||
$title = esc_attr( $instance['title'] );
|
||||
$title = $before_title . $title . $after_title;
|
||||
|
||||
$params = array();
|
||||
|
||||
foreach ( $instance as $key => $value ) {
|
||||
$params[ $key ] = $value;
|
||||
}
|
||||
|
||||
$instance = $params;
|
||||
|
||||
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/about/views/widget.php';
|
||||
|
||||
if ( file_exists( $filepath ) ) {
|
||||
include( $filepath );
|
||||
} else {
|
||||
esc_html_e( 'View not found', 'solarify' );
|
||||
}
|
||||
}
|
||||
|
||||
function update( $new_instance, $old_instance ) {
|
||||
return fw_get_options_values_from_input(
|
||||
$this->options,
|
||||
FW_Request::POST( fw_html_attr_name_to_array_multi_key( $this->get_field_name( $this->prefix ) ), array() )
|
||||
);
|
||||
}
|
||||
|
||||
function form( $values ) {
|
||||
|
||||
$prefix = $this->get_field_id( $this->prefix ); // Get unique prefix, preventing duplicated key
|
||||
$id = 'fw-widget-options-' . $prefix;
|
||||
|
||||
// Print our options
|
||||
echo '<div class="fw-force-xs fw-theme-admin-widget-wrap fw-framework-widget-options-widget" data-fw-widget-id="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '">';
|
||||
|
||||
echo fw()->backend->render_options( $this->options, $values, array(
|
||||
'id_prefix' => $prefix . '-',
|
||||
'name_prefix' => $this->get_field_name( $this->prefix ),
|
||||
) );
|
||||
echo '</div>';
|
||||
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die();
|
||||
}
|
||||
if ( ! defined( 'FW' ) ) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @var string $before_widget
|
||||
* @var string $after_widget
|
||||
* @var array $params
|
||||
*/
|
||||
$footer_variant = fw_get_db_customizer_option( 'footer' );
|
||||
$logo_image_variant = ( $footer_variant === '2' ) ? 'logo_image_light' : 'logo_image';
|
||||
$unique_id = uniqid();
|
||||
$logo_image = ( function_exists( 'fw_get_db_settings_option' ) ) ? fw_get_db_customizer_option( $logo_image_variant ) : '';
|
||||
|
||||
$logo_text = ( function_exists( 'fw_get_db_settings_option' ) ) ? fw_get_db_customizer_option( 'logo_text' ) : get_option( 'blogname' );
|
||||
|
||||
echo wp_kses_post( $before_widget );
|
||||
|
||||
if ( $logo_image ) : ?>
|
||||
<div class="footer_logo">
|
||||
<img src="<?php echo esc_attr( $logo_image['url'] ); ?>"
|
||||
alt="<?php echo esc_attr( $logo_text ); ?>">
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="logo">
|
||||
<span class="logo_text">
|
||||
<?php echo esc_html( $logo_text ); ?>
|
||||
</span class="logo_text">
|
||||
</div>
|
||||
<?php endif;
|
||||
|
||||
if ( !empty( $params['title'] ) ) {
|
||||
echo wp_kses_post( $title );
|
||||
}
|
||||
|
||||
|
||||
if ( $params['about'] ) { ?>
|
||||
|
||||
<div class="divider_20">
|
||||
<?php echo wp_kses_post( $params['about'] ); ?>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
|
||||
echo wp_kses_post( $after_widget );
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die();
|
||||
}
|
||||
if ( ( defined( 'FW' ) ) && ! ( class_exists( 'Solarify_Widget_Banner' ) ) ) :
|
||||
|
||||
class Solarify_Widget_Banner extends WP_Widget {
|
||||
|
||||
/**
|
||||
* Widget constructor.
|
||||
*/
|
||||
private $options;
|
||||
private $prefix;
|
||||
|
||||
function __construct() {
|
||||
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_banner',
|
||||
'description' => esc_html__( 'Add linked image with text', 'solarify' ),
|
||||
);
|
||||
|
||||
parent::__construct( false, esc_html__( 'Theme - Ad Banner', 'solarify' ), $widget_ops );
|
||||
|
||||
//Create our options by using Unyson option types
|
||||
$this->options = array(
|
||||
'title' => array(
|
||||
'type' => 'text',
|
||||
'label' => esc_html__( 'Widget Title', 'solarify' ),
|
||||
),
|
||||
'image' => array(
|
||||
'type' => 'upload',
|
||||
'value' => '',
|
||||
'label' => esc_html__( 'Banner Image', 'solarify' ),
|
||||
'images_only' => true,
|
||||
),
|
||||
'url' => array(
|
||||
'type' => 'text',
|
||||
'value' => '',
|
||||
'label' => esc_html__( 'Banner URL', 'solarify' ),
|
||||
),
|
||||
|
||||
);
|
||||
$this->prefix = 'widget_banner';
|
||||
}
|
||||
|
||||
function widget( $args, $instance ) {
|
||||
extract( wp_parse_args( $args ) );
|
||||
|
||||
$params = array();
|
||||
|
||||
foreach ( $instance as $key => $value ) {
|
||||
$params[ $key ] = $value;
|
||||
}
|
||||
|
||||
$instance = $params;
|
||||
|
||||
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/banner/views/widget.php';
|
||||
|
||||
if ( file_exists( $filepath ) ) {
|
||||
include( $filepath );
|
||||
} else {
|
||||
esc_html_e( 'View not found', 'solarify' );
|
||||
}
|
||||
}
|
||||
|
||||
function update( $new_instance, $old_instance ) {
|
||||
return fw_get_options_values_from_input(
|
||||
$this->options,
|
||||
FW_Request::POST( fw_html_attr_name_to_array_multi_key( $this->get_field_name( $this->prefix ) ), array() )
|
||||
);
|
||||
}
|
||||
|
||||
function form( $values ) {
|
||||
|
||||
$prefix = $this->get_field_id( $this->prefix ); // Get unique prefix, preventing duplicated key
|
||||
$id = 'fw-widget-options-' . $prefix;
|
||||
|
||||
// Print our options
|
||||
echo '<div class="fw-force-xs fw-theme-admin-widget-wrap fw-framework-widget-options-widget" data-fw-widget-id="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '">';
|
||||
|
||||
echo fw()->backend->render_options( $this->options, $values, array(
|
||||
'id_prefix' => $prefix . '-',
|
||||
'name_prefix' => $this->get_field_name( $this->prefix ),
|
||||
) );
|
||||
echo '</div>';
|
||||
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die();
|
||||
}
|
||||
if ( ! defined( 'FW' ) ) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @var string $before_widget
|
||||
* @var string $after_widget
|
||||
* @var array $params
|
||||
*/
|
||||
$unique_id = uniqid();
|
||||
echo wp_kses_post( $before_widget );
|
||||
if ( !empty ( $params['title'] ) ) {
|
||||
echo wp_kses_post( $before_title . $params['title'] . $after_title );
|
||||
}
|
||||
if ( !empty ( $params['url'] ) ) : ?>
|
||||
<a href="<?php echo esc_url( $params['url'] ); ?>" target="_blank">
|
||||
<?php endif; //url
|
||||
if ( !empty( $params['image'] ) ) : ?>
|
||||
<img src="<?php echo esc_url( $params['image']['url'] ); ?>" alt="">
|
||||
<?php endif; //image
|
||||
if ( !empty( $params['url'] ) ) : ?>
|
||||
</a>
|
||||
<?php endif; //url ?>
|
||||
<?php echo wp_kses_post( $after_widget );
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die();
|
||||
}
|
||||
if ( ( defined( 'FW' ) ) && ! ( class_exists( 'Solarify_Widget_Contacts' ) ) ) :
|
||||
|
||||
class Solarify_Widget_Contacts extends WP_Widget {
|
||||
|
||||
/**
|
||||
* Widget constructor.
|
||||
*/
|
||||
private $options;
|
||||
private $prefix;
|
||||
|
||||
function __construct() {
|
||||
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_contacts',
|
||||
'description' => esc_html__( 'Add company logo with contacts', 'solarify' ),
|
||||
);
|
||||
|
||||
parent::__construct( false, esc_html__( 'Theme - Contacts', 'solarify' ), $widget_ops );
|
||||
|
||||
//Create our options by using Unyson option types
|
||||
$this->options = array(
|
||||
'title' => array(
|
||||
'type' => 'text',
|
||||
'label' => esc_html__( 'Widget Title', 'solarify' ),
|
||||
),
|
||||
'contacts' => array(
|
||||
'type' => 'addable-box',
|
||||
'value' => array(
|
||||
array(
|
||||
'contact_info' => 'contact info',
|
||||
),
|
||||
),
|
||||
'label' => esc_html__('Contact item', 'solarify'),
|
||||
'desc' => esc_html__('Media element with contact info and related icon', 'solarify'),
|
||||
'help' => esc_html__('Enter contact info and choose icon', 'solarify'),
|
||||
'box-options' => array(
|
||||
'contact_info' => array( 'type' => 'textarea' ),
|
||||
'link' => array(
|
||||
'type' => 'text',
|
||||
'value' => '',
|
||||
'label' => esc_html__('Link address', 'solarify'),
|
||||
'desc' => esc_html__('Fill this field only if you want it to be a link', 'solarify'),
|
||||
),
|
||||
'icon' => array(
|
||||
'type' => 'icon-v2',
|
||||
'label' => esc_html__( 'Choose an Icon', 'solarify' )
|
||||
),
|
||||
),
|
||||
'template' => esc_html__( 'Contact Item', 'solarify' ), // box title
|
||||
'add-button-text' => esc_html__('Add', 'solarify'),
|
||||
'sortable' => true,
|
||||
)
|
||||
|
||||
);
|
||||
$this->prefix = 'widget_contacts';
|
||||
}
|
||||
|
||||
function widget( $args, $instance ) {
|
||||
extract( wp_parse_args( $args ) );
|
||||
|
||||
$title = esc_attr( $instance['title'] );
|
||||
$title = $before_title . $title . $after_title;
|
||||
|
||||
$params = array();
|
||||
|
||||
foreach ( $instance as $key => $value ) {
|
||||
$params[ $key ] = $value;
|
||||
}
|
||||
|
||||
$instance = $params;
|
||||
|
||||
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/contacts/views/widget.php';
|
||||
|
||||
if ( file_exists( $filepath ) ) {
|
||||
include( $filepath );
|
||||
} else {
|
||||
esc_html_e( 'View not found', 'solarify' );
|
||||
}
|
||||
}
|
||||
|
||||
function update( $new_instance, $old_instance ) {
|
||||
return fw_get_options_values_from_input(
|
||||
$this->options,
|
||||
FW_Request::POST( fw_html_attr_name_to_array_multi_key( $this->get_field_name( $this->prefix ) ), array() )
|
||||
);
|
||||
}
|
||||
|
||||
function form( $values ) {
|
||||
|
||||
$prefix = $this->get_field_id( $this->prefix ); // Get unique prefix, preventing duplicated key
|
||||
$id = 'fw-widget-options-' . $prefix;
|
||||
|
||||
// Print our options
|
||||
echo '<div class="fw-force-xs fw-theme-admin-widget-wrap fw-framework-widget-options-widget" data-fw-widget-id="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '">';
|
||||
|
||||
echo fw()->backend->render_options( $this->options, $values, array(
|
||||
'id_prefix' => $prefix . '-',
|
||||
'name_prefix' => $this->get_field_name( $this->prefix ),
|
||||
) );
|
||||
echo '</div>';
|
||||
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die();
|
||||
}
|
||||
if ( ! defined( 'FW' ) ) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @var string $before_widget
|
||||
* @var string $after_widget
|
||||
* @var array $params
|
||||
* @var $title
|
||||
*/
|
||||
$unique_id = uniqid();
|
||||
echo wp_kses_post( $before_widget );
|
||||
echo wp_kses_post( $title );
|
||||
?>
|
||||
|
||||
<ul class="list-unstyled greylinks">
|
||||
<?php foreach ( $params['contacts'] as $contact ) : ?>
|
||||
<li>
|
||||
<div class="media small-media">
|
||||
<?php if ( !empty( $contact['icon'] ) ) : ?>
|
||||
<div class="media-left media-middle">
|
||||
<?php if ( $contact['icon']['type'] === 'icon-font') : ?>
|
||||
<i class="<?php echo esc_attr( $contact['icon']['icon-class'] ); ?> highlight fontsize_24 cons-width"></i>
|
||||
<?php else:
|
||||
echo wp_get_attachment_image( $contact['icon']['attachment-id'] );
|
||||
endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="media-body media-middle greylinks">
|
||||
<?php if ( !empty( $contact['link'] ) ) : ?>
|
||||
<a href="<?php echo esc_attr( $contact['link'] ); ?>">
|
||||
<?php endif;
|
||||
echo nl2br( esc_html( $contact['contact_info'] ) );
|
||||
if ( !empty( $contact['link'] ) ) : ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php echo wp_kses_post( $after_widget );
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
if ( class_exists( 'Solarify_Widget_Facebook_Page_Stream' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( defined( 'FW' ) ) {
|
||||
$fw_social_facebook = fw()->extensions->get( 'social-facebook' );
|
||||
|
||||
if ( ! empty( $fw_social_facebook ) ) {
|
||||
|
||||
class Solarify_Widget_Facebook_Page_Stream extends WP_Widget {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function __construct() {
|
||||
//widget_recent_entries
|
||||
//widget_facebook_page_stream
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_recent_entries widget_facebook_page_stream',
|
||||
'description' => esc_html__( 'FaceBook Page Steam', 'solarify' )
|
||||
);
|
||||
parent::__construct( false, esc_html__( 'Theme - Facebook', 'solarify' ), $widget_ops );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
* @param array $instance
|
||||
*/
|
||||
function widget( $args, $instance ) {
|
||||
extract( $args );
|
||||
|
||||
$title = esc_attr( $instance['title'] );
|
||||
$page_id = esc_attr( $instance['page_id'] );
|
||||
$number = ( (int) ( esc_attr( $instance['number'] ) ) > 0 ) ? esc_attr( $instance['number'] ) : 5;
|
||||
$title = $before_title . $title . $after_title;
|
||||
|
||||
$result = fw_ext_social_facebook_graph_api_explorer( 'GET', $page_id, array( 'fields' => 'posts.limit(' . $number . '){message}' ) );
|
||||
$result = json_decode( $result );
|
||||
|
||||
if ( ! empty( $result->posts->data ) ) {
|
||||
$posts = $result->posts->data;
|
||||
|
||||
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/facebook-page-stream/views/widget.php';
|
||||
|
||||
if ( file_exists( $filepath ) ) {
|
||||
include( $filepath );
|
||||
} else {
|
||||
esc_html_e( 'View not found', 'solarify' );
|
||||
}
|
||||
|
||||
} else {
|
||||
esc_html_e( 'Facebook in Social Extension not configured', 'solarify' );
|
||||
}
|
||||
}
|
||||
|
||||
function update( $new_instance, $old_instance ) {
|
||||
return $new_instance;
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'page_id' => '', 'number' => '' ) );
|
||||
?>
|
||||
<p>
|
||||
<label
|
||||
for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'solarify' ); ?> </label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
|
||||
value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat"
|
||||
id="<?php $this->get_field_id( 'title' ); ?>"/>
|
||||
</p>
|
||||
<p>
|
||||
<label
|
||||
for="<?php echo esc_attr( $this->get_field_id( 'page_id' ) ); ?>"><?php esc_html_e( 'Page ID:', 'solarify' ); ?> </label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'page_id' ) ); ?>"
|
||||
value="<?php echo esc_attr( $instance['page_id'] ); ?>" class="widefat"
|
||||
id="<?php $this->get_field_id( 'page_id' ); ?>"/>
|
||||
</p>
|
||||
<p>
|
||||
<label
|
||||
for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of posts:', 'solarify' ); ?>
|
||||
:</label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>"
|
||||
value="<?php echo esc_attr( $instance['number'] ); ?>" class="widefat"
|
||||
id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @var $number
|
||||
* @var $before_widget
|
||||
* @var $after_widget
|
||||
* @var $title
|
||||
* @var $posts
|
||||
*/
|
||||
echo wp_kses_post( $before_widget );
|
||||
echo wp_kses_post( $title );
|
||||
?>
|
||||
<ul class="darklinks">
|
||||
<?php
|
||||
foreach ( $posts as $post ) {
|
||||
if ( isset( $post->message ) ) {
|
||||
echo '<li><a href="' . esc_url( 'https://facebook.com/' . $post->id . '/') . '">' . wp_kses_post( wp_trim_words( $post->message, 24 ) ) . '</a></li>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php echo wp_kses_post( $after_widget ); ?>
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
if ( class_exists( 'Solarify_Widget_Flickr' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
class Solarify_Widget_Flickr extends WP_Widget {
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function __construct() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_flickr',
|
||||
'description' => esc_html__( 'Add linked image with text', 'solarify' ),
|
||||
);
|
||||
parent::__construct( false, esc_html__( 'Theme - Flickr', 'solarify' ), $widget_ops );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
* @param array $instance
|
||||
*/
|
||||
function widget( $args, $instance ) {
|
||||
extract( $args );
|
||||
|
||||
$flickr_id = esc_attr( $instance['flickr_id'] );
|
||||
$title = esc_attr( $instance['title'] );
|
||||
$number = ( (int) ( esc_attr( $instance['number'] ) ) > 0 ) ? esc_attr( $instance['number'] ) : 8;
|
||||
$title = $before_title . $title . $after_title;
|
||||
|
||||
wp_enqueue_script(
|
||||
'solarify-flickr-widget',
|
||||
SOLARIFY_THEME_URI . '/inc/widgets/flickr/static/js/jflickrfeed.min.js',
|
||||
array( 'jquery' ),
|
||||
'1.0'
|
||||
);
|
||||
|
||||
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/flickr/views/widget.php';
|
||||
|
||||
if ( file_exists( $filepath ) ) {
|
||||
include( $filepath );
|
||||
} else {
|
||||
esc_html_e( 'View not found', 'solarify' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function update( $new_instance, $old_instance ) {
|
||||
return $new_instance;
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'flickr_id' => '', 'number' => '', 'title' => '' ) );
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'solarify' ); ?> </label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
|
||||
value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat"
|
||||
id="<?php $this->get_field_id( 'title' ); ?>"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'flickr_id' ) ); ?>"><?php esc_html_e( 'Flickr ID', 'solarify' ); ?> (<a
|
||||
href="http://www.idgettr.com" target="_blank">idGettr</a>):</label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'flickr_id' ) ); ?>"
|
||||
value="<?php echo esc_attr( $instance['flickr_id'] ); ?>" class="widefat"
|
||||
id="<?php $this->get_field_id( 'flickr_id' ); ?>"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of photos', 'solarify' ); ?>
|
||||
:</label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>"
|
||||
value="<?php echo esc_attr( $instance['number'] ); ?>" class="widefat"
|
||||
id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
16
wp-content/themes/solarify/inc/widgets/flickr/static/js/jflickrfeed.min.js
vendored
Normal file
16
wp-content/themes/solarify/inc/widgets/flickr/static/js/jflickrfeed.min.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2009 Joel Sutherland
|
||||
* Licenced under the MIT license
|
||||
* http://www.newmediacampaigns.com/page/jquery-flickr-plugin
|
||||
*
|
||||
* Available tags for templates:
|
||||
* title, link, date_taken, description, published, author, author_id, tags, image*
|
||||
*/
|
||||
(function($){$.fn.jflickrfeed=function(settings,callback){settings=$.extend(true,{flickrbase:'http://api.flickr.com/services/feeds/',feedapi:'photos_public.gne',limit:20,qstrings:{lang:'en-us',format:'json',jsoncallback:'?'},cleanDescription:true,useTemplate:true,itemTemplate:'',itemCallback:function(){}},settings);var url=settings.flickrbase+settings.feedapi+'?';var first=true;for(var key in settings.qstrings){if(!first)
|
||||
url+='&';url+=key+'='+settings.qstrings[key];first=false;}
|
||||
return $(this).each(function(){var $container=$(this);var container=this;$.getJSON(url,function(data){$.each(data.items,function(i,item){if(i<settings.limit){if(settings.cleanDescription){var regex=/<p>(.*?)<\/p>/g;var input=item.description;if(regex.test(input)){item.description=input.match(regex)[2]
|
||||
if(item.description!=undefined)
|
||||
item.description=item.description.replace('<p>','').replace('</p>','');}}
|
||||
item['image_s']=item.media.m.replace('_m','_s');item['image_t']=item.media.m.replace('_m','_t');item['image_m']=item.media.m.replace('_m','_m');item['image']=item.media.m.replace('_m','');item['image_b']=item.media.m.replace('_m','_b');delete item.media;if(settings.useTemplate){var template=settings.itemTemplate;for(var key in item){var rgx=new RegExp('{{'+key+'}}','g');template=template.replace(rgx,item[key]);}
|
||||
$container.append(template)}
|
||||
settings.itemCallback.call(container,item);}});if($.isFunction(callback)){callback.call(container,data);}});});}})(jQuery);
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) { die( 'Direct access forbidden.' ); }
|
||||
|
||||
/**
|
||||
* @var $number
|
||||
* @var $before_widget
|
||||
* @var $after_widget
|
||||
* @var $title
|
||||
* @var $flickr_id
|
||||
*/
|
||||
|
||||
echo wp_kses_post( $before_widget );
|
||||
echo wp_kses_post( $title );
|
||||
?>
|
||||
<div class="wrap-flickr">
|
||||
<ul class="flickr_ul" data-flickr-number="<?php echo esc_attr( $number ); ?>" data-flickr-id="<?php echo esc_attr( $flickr_id ); ?>"></ul>
|
||||
</div>
|
||||
<?php echo wp_kses_post ( $after_widget );
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
if ( class_exists( 'Solarify_Widget_Popular' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
class Solarify_Widget_Popular extends WP_Widget {
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __construct() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_popular_entries',
|
||||
'description' => esc_html__( 'Most commented Posts', 'solarify' ),
|
||||
);
|
||||
parent::__construct( false, esc_html__( 'Theme - Popular Posts', 'solarify' ), $widget_ops );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
* @param array $instance
|
||||
*/
|
||||
public function widget( $args, $instance ) {
|
||||
extract( $args );
|
||||
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
|
||||
$number = ( (int) ( $instance['number'] ) > 0 ) ? esc_attr( $instance['number'] ) : 5;
|
||||
|
||||
$popular_posts = $this->fw_get_posts_with_info( array(
|
||||
'sort' => 'comment_count',
|
||||
'items' => $number,
|
||||
) );
|
||||
|
||||
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/popular/views/widget.php';
|
||||
|
||||
if ( file_exists( $filepath ) ) {
|
||||
include( $filepath );
|
||||
} else {
|
||||
esc_html_e( 'View not found', 'solarify' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fw_get_posts_with_info( $args = array() ) {
|
||||
$defaults = array(
|
||||
'sort' => 'recent',
|
||||
'items' => 5,
|
||||
'image_post' => true,
|
||||
'date_post' => true,
|
||||
'date_format' => 'F jS, Y',
|
||||
'post_type' => 'post',
|
||||
|
||||
);
|
||||
|
||||
extract( wp_parse_args( $args, $defaults ) );
|
||||
|
||||
$query = new WP_Query( array(
|
||||
'post_type' => $post_type,
|
||||
'orderby' => $sort,
|
||||
'order' => 'DESC',
|
||||
'ignore_sticky_posts' => true,
|
||||
'posts_per_page' => $items
|
||||
) );
|
||||
|
||||
//wp reset query removed
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $new_instance
|
||||
* @param array $old_instance
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
return $new_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $instance
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'number' => '', 'title' => '' ) );
|
||||
$title = sanitize_text_field( $instance['title'] );
|
||||
$number = esc_attr( $instance['number'] );
|
||||
?>
|
||||
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'solarify' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
|
||||
value="<?php echo esc_attr( $title ); ?>"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of Blog posts', 'solarify' ); ?>
|
||||
:</label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" value="<?php echo esc_attr( $number ); ?>"
|
||||
class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
/**
|
||||
* @var string $before_widget
|
||||
* @var string $after_widget
|
||||
* @var array $popular_posts
|
||||
*/
|
||||
$unique_id = uniqid();
|
||||
|
||||
echo wp_kses_post( $before_widget );
|
||||
|
||||
if ( $title ) {
|
||||
echo wp_kses_post( $before_title . $title . $after_title );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<ul id="popular_posts_<?php echo esc_attr( $unique_id ); ?>" class="media-list darklinks">
|
||||
<?php while ( $popular_posts->have_posts() ) : $popular_posts->the_post(); ?>
|
||||
<li <?php post_class( 'media' ); ?>>
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<a href="<?php the_permalink(); ?>" class="media-left">
|
||||
<?php echo get_the_post_thumbnail( get_the_ID(), 'thumbnail' ); ?>
|
||||
</a>
|
||||
<?php endif; //has_post_thumbnail ?>
|
||||
<div class="media-body">
|
||||
<p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
|
||||
<div class="item-meta">
|
||||
<?php
|
||||
// Set up and print post meta information.
|
||||
if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
|
||||
<!-- comments number and link
|
||||
<span class="comments-link">
|
||||
<i class="rt-icon2-bubble highlight"></i>
|
||||
<?php comments_popup_link( esc_html__( 'No comments', 'solarify' ), esc_html__( '1 comment', 'solarify' ), esc_html__( '% comments', 'solarify' ) ); ?>
|
||||
</span>
|
||||
-->
|
||||
<?php
|
||||
endif; //post_password_required
|
||||
?>
|
||||
<span>
|
||||
<i class="rt-icon2-heart-outline highlight"></i>
|
||||
<?php
|
||||
solarify_post_like_count( get_the_ID() );
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endwhile; ?>
|
||||
<?php wp_reset_postdata(); // reset the query ?>
|
||||
</ul>
|
||||
<?php echo wp_kses_post( $after_widget ); ?>
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
if ( class_exists( 'Solarify_Widget_Post_Tabs' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
class Solarify_Widget_Post_Tabs extends WP_Widget {
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __construct() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_tabs',
|
||||
'description' => esc_html__( 'Recent and Popular posts in tabs', 'solarify' ),
|
||||
);
|
||||
parent::__construct( false, esc_html__( 'Theme - Blog Tabs', 'solarify' ), $widget_ops );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
* @param array $instance
|
||||
*/
|
||||
public function widget( $args, $instance ) {
|
||||
extract( $args );
|
||||
$number = ( (int) ( $instance['number'] ) > 0 ) ? esc_attr( $instance['number'] ) : 5;
|
||||
|
||||
$recent_posts = $this->fw_get_posts_with_info( array(
|
||||
'sort' => 'post_date',
|
||||
'items' => $number,
|
||||
) );
|
||||
|
||||
$popular_posts = $this->fw_get_posts_with_info( array(
|
||||
'sort' => 'comment_count',
|
||||
'items' => $number,
|
||||
) );
|
||||
|
||||
|
||||
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/post-tabs/views/widget.php';
|
||||
|
||||
if ( file_exists( $filepath ) ) {
|
||||
include( $filepath );
|
||||
} else {
|
||||
esc_html_e( 'View not found', 'solarify' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fw_get_posts_with_info( $args = array() ) {
|
||||
$defaults = array(
|
||||
'sort' => 'recent',
|
||||
'items' => 5,
|
||||
'image_post' => true,
|
||||
'date_post' => true,
|
||||
'date_format' => 'F jS, Y',
|
||||
'post_type' => 'post',
|
||||
|
||||
);
|
||||
|
||||
extract( wp_parse_args( $args, $defaults ) );
|
||||
|
||||
$query = new WP_Query( array(
|
||||
'post_type' => $post_type,
|
||||
'orderby' => $sort,
|
||||
'order' => 'DESC',
|
||||
'ignore_sticky_posts' => true,
|
||||
'posts_per_page' => $items
|
||||
) );
|
||||
|
||||
//wp reset query removed
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $new_instance
|
||||
* @param array $old_instance
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
return $new_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $instance
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'number' => '', 'title' => '' ) );
|
||||
$number = esc_attr( $instance['number'] );
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of Blog posts', 'solarify' ); ?>
|
||||
:</label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" value="<?php echo esc_attr( $number ); ?>"
|
||||
class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
/**
|
||||
* @var string $before_widget
|
||||
* @var string $after_widget
|
||||
* @var array $recent_posts
|
||||
* @var array $popular_posts
|
||||
*/
|
||||
$unique_id = uniqid();
|
||||
|
||||
echo wp_kses_post( $before_widget );
|
||||
?>
|
||||
<div class="tabs small-tabs">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li><a href="#popular_posts_<?php echo esc_attr( $unique_id ); ?>" role="tab"
|
||||
data-toggle="tab"><?php esc_html_e( 'Popular', 'solarify' ); ?></a></li>
|
||||
<li><a href="#recent_<?php echo esc_attr( $unique_id ); ?>" role="tab"
|
||||
data-toggle="tab"><?php esc_html_e( 'Recent', 'solarify' ); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-content top-color-border no-border">
|
||||
<div id="popular_posts_<?php echo esc_attr( $unique_id ); ?>" class="tab-pane fade">
|
||||
<?php while ( $popular_posts->have_posts() ) : $popular_posts->the_post(); ?>
|
||||
<div <?php post_class( 'vertical-item' ); ?>>
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<a href="<?php the_permalink(); ?>">
|
||||
<?php echo get_the_post_thumbnail( get_the_ID() ); ?>
|
||||
</a>
|
||||
<?php endif; //has_post_thumbnail ?>
|
||||
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
|
||||
<p class="item-meta">
|
||||
<?php
|
||||
solarify_posted_on();
|
||||
?>
|
||||
<span class="pull-right">
|
||||
<i class="rt-icon2-heart-outline highlight"></i>
|
||||
<?php
|
||||
solarify_post_like_count( get_the_ID() );
|
||||
?>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
<?php wp_reset_postdata(); // reset the query ?>
|
||||
</div>
|
||||
<div id="recent_<?php echo esc_attr( $unique_id ); ?>" class="tab-pane fade">
|
||||
<?php while ( $recent_posts->have_posts() ) : $recent_posts->the_post(); ?>
|
||||
<div <?php post_class( 'vertical-item' ); ?> id="widget-post-tabs-post-<?php the_ID(); ?>">
|
||||
<?php if ( has_post_thumbnail( get_the_ID() ) ) : ?>
|
||||
<a href="<?php the_permalink(); ?>">
|
||||
<?php echo get_the_post_thumbnail( get_the_ID() ); ?>
|
||||
</a>
|
||||
<?php endif; //has_post_thumbnail ?>
|
||||
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
|
||||
<p class="item-meta">
|
||||
<?php solarify_posted_on(); ?>
|
||||
<span class="pull-right">
|
||||
<i class="rt-icon2-heart-outline highlight"></i>
|
||||
<?php
|
||||
solarify_post_like_count( get_the_ID() );
|
||||
?>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php endwhile; ?>
|
||||
<?php wp_reset_postdata(); // reset the query ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo wp_kses_post( $after_widget ); ?>
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
if ( class_exists( 'Solarify_Widget_Recent' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
class Solarify_Widget_Recent extends WP_Widget {
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __construct() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_recent_posts',
|
||||
'description' => esc_html__( 'Most Recent Posts with Images', 'solarify' ),
|
||||
);
|
||||
parent::__construct( false, esc_html__( 'Theme - Recent Posts (thumbnail)', 'solarify' ), $widget_ops );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
* @param array $instance
|
||||
*/
|
||||
public function widget( $args, $instance ) {
|
||||
extract( $args );
|
||||
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
|
||||
$number = ( (int) ( $instance['number'] ) > 0 ) ? esc_attr( $instance['number'] ) : 5;
|
||||
|
||||
$popular_posts = $this->fw_get_posts_with_info( array(
|
||||
'items' => $number,
|
||||
) );
|
||||
|
||||
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/recent/views/widget.php';
|
||||
|
||||
if ( file_exists( $filepath ) ) {
|
||||
include( $filepath );
|
||||
} else {
|
||||
esc_html_e( 'View not found', 'solarify' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fw_get_posts_with_info( $args = array() ) {
|
||||
$defaults = array(
|
||||
'sort' => 'recent',
|
||||
'items' => 5,
|
||||
'image_post' => true,
|
||||
'date_post' => true,
|
||||
'date_format' => 'F jS, Y',
|
||||
'post_type' => 'post',
|
||||
|
||||
);
|
||||
|
||||
extract( wp_parse_args( $args, $defaults ) );
|
||||
|
||||
$query = new WP_Query( array(
|
||||
'post_type' => $post_type,
|
||||
'orderby' => $sort,
|
||||
'order' => 'DESC',
|
||||
'ignore_sticky_posts' => true,
|
||||
'posts_per_page' => $items
|
||||
) );
|
||||
|
||||
//wp reset query removed
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $new_instance
|
||||
* @param array $old_instance
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
return $new_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $instance
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'number' => '', 'title' => '' ) );
|
||||
$title = sanitize_text_field( $instance['title'] );
|
||||
$number = esc_attr( $instance['number'] );
|
||||
?>
|
||||
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'solarify' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
|
||||
value="<?php echo esc_attr( $title ); ?>"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of Blog posts', 'solarify' ); ?>
|
||||
:</label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" value="<?php echo esc_attr( $number ); ?>"
|
||||
class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
/**
|
||||
* @var string $before_widget
|
||||
* @var string $after_widget
|
||||
* @var array $popular_posts
|
||||
*/
|
||||
$unique_id = uniqid();
|
||||
|
||||
echo wp_kses_post( $before_widget );
|
||||
|
||||
if ( $title ) {
|
||||
echo wp_kses_post( $before_title . $title . $after_title );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<ul id="recent_posts_<?php echo esc_attr( $unique_id ); ?>" class="media-list">
|
||||
<?php while ( $popular_posts->have_posts() ) : $popular_posts->the_post(); ?>
|
||||
<li <?php post_class( 'media' ); ?>>
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<a href="<?php the_permalink(); ?>" class="media-left media-middle">
|
||||
<?php echo get_the_post_thumbnail( get_the_ID(), 'thumbnail' ); ?>
|
||||
</a>
|
||||
<?php endif; //has_post_thumbnail ?>
|
||||
<div class="media-body media-middle text-left">
|
||||
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
|
||||
</div>
|
||||
</li>
|
||||
<?php endwhile; ?>
|
||||
<?php wp_reset_postdata(); // reset the query ?>
|
||||
</ul>
|
||||
<?php echo wp_kses_post( $after_widget ); ?>
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
if ( defined( 'FW' ) && function_exists( 'fw_ext_social_twitter_get_connection' ) && function_exists( 'curl_exec' ) ) {
|
||||
|
||||
class Solarify_Widget_Twitter extends WP_Widget {
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function __construct() {
|
||||
$widget_ops = array( 'description' => 'Twitter Feed' );
|
||||
parent::__construct( false, esc_html__( 'Theme - Twitter', 'solarify' ), $widget_ops );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
* @param array $instance
|
||||
*/
|
||||
function widget( $args, $instance ) {
|
||||
extract( $args );
|
||||
|
||||
$user = esc_attr( $instance['user'] );
|
||||
$title = esc_attr( $instance['title'] );
|
||||
$number = ( (int) ( esc_attr( $instance['number'] ) ) > 0 ) ? esc_attr( $instance['number'] ) : 5;
|
||||
$title = $before_title . $title . $after_title;
|
||||
|
||||
|
||||
// $tweets = get_site_transient( 'scratch_tweets_' . $user . '_' . '2' );
|
||||
$tweets = '';
|
||||
|
||||
if ( empty( $tweets ) ) {
|
||||
/* @var $connection TwitterOAuth */
|
||||
$connection = fw_ext_social_twitter_get_connection();
|
||||
$tweets = $connection->get( "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=" . $user . "&count=" . $number );
|
||||
set_site_transient( 'scratch_tweets_' . $user . '_' . $number, $tweets, 12 * HOUR_IN_SECONDS );
|
||||
}
|
||||
$widget_tweets = array();
|
||||
|
||||
if ( empty( $tweets->errors ) ) {
|
||||
|
||||
foreach ( $tweets as $key => $tweet ) :
|
||||
$widget_tweets[ $key ][ 'text' ] = make_clickable( $tweet->text );
|
||||
$widget_tweets[ $key ][ 'created_at' ] = mysql2date( 'F j, Y g:i a', $tweet->created_at );
|
||||
$widget_tweets[ $key ][ 'profile_image_url' ] = $tweet->user->profile_image_url;
|
||||
$widget_tweets[ $key ][ 'name' ] = $tweet->user->name;
|
||||
endforeach;
|
||||
|
||||
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/twitter/views/widget.php';
|
||||
|
||||
if ( file_exists( $filepath ) ) {
|
||||
include( $filepath );
|
||||
} else {
|
||||
esc_html_e( 'View not found', 'solarify' );
|
||||
}
|
||||
} else {
|
||||
esc_html_e( 'Twitter in Social Extension not configured', 'solarify' );
|
||||
}
|
||||
|
||||
} //widget
|
||||
|
||||
function update( $new_instance, $old_instance ) {
|
||||
return $new_instance;
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'user' => '', 'number' => '', 'title' => '' ) );
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'solarify' ); ?> </label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
|
||||
value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat"
|
||||
id="<?php $this->get_field_id( 'title' ); ?>"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'user' ) ); ?>"><?php esc_html_e( 'User', 'solarify' ); ?> :</label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'user' ) ); ?>"
|
||||
value="<?php echo esc_attr( $instance['user'] ); ?>" class="widefat"
|
||||
id="<?php $this->get_field_id( 'user' ); ?>"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of tweets', 'solarify' ); ?>
|
||||
:</label>
|
||||
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>"
|
||||
value="<?php echo esc_attr( $instance['number'] ); ?>" class="widefat"
|
||||
id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
} //class
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Direct access forbidden.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @var $number
|
||||
* @var $before_widget
|
||||
* @var $after_widget
|
||||
* @var $title
|
||||
* @var $tweets
|
||||
*/
|
||||
|
||||
echo wp_kses_post ( $before_widget );
|
||||
echo wp_kses_post ( $title );
|
||||
?>
|
||||
<ul class="tweet_list highlightlinks">
|
||||
<?php
|
||||
foreach ( $widget_tweets as $tweet ) : ?>
|
||||
<li>
|
||||
<div class="tweet">
|
||||
<span class="tweet_text">
|
||||
<?php echo wp_kses_post ( $tweet['text'] ); ?>
|
||||
</span>
|
||||
<span class="tweet_time">
|
||||
<?php echo wp_kses_post ( $tweet['created_at'] ); ?>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php echo wp_kses_post ( $after_widget ); ?>
|
||||
Reference in New Issue
Block a user