esc_html__('Main Menu','bundler'),
'pmcrespmenu' => esc_html__('Responsive Menu','bundler'),
'pmcscrollmenu' => esc_html__('Scroll Menu','bundler'),
));
if(isset($bundler_data['sidebar'])){
$sidebars = $bundler_data['sidebar'];
$sidebarOut = '';
foreach($sidebars as $sidebar){
$title = $sidebar['title'];
$id = preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s', '', $sidebar['title']);
$id = strtolower(str_replace(' ', '' , $id));
register_sidebar(array(
'id' => $id,
'name' => $title ,
'description' => __('This is custom widget added via theme options.', 'bundler'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => ' '
));
}
}
register_sidebar(array(
'id' => 'sidebar',
'name' => esc_html__('Sidebar main','bundler'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
register_sidebar(array(
'id' => 'sidebar-deals-page',
'name' => esc_html__('Sidebar for page deals','bundler'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => ' '
));
register_sidebar(array(
'id' => 'sidebar-delas-blog',
'name' => esc_html__('Blog deals sidebar','bundler'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => ' '
));
register_sidebar(array(
'id' => 'sidebar-top-left',
'name' => esc_html__('Top sidebar left','bundler'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => ' '
));
register_sidebar(array(
'id' => 'sidebar-top-right',
'name' => esc_html__('Top sidebar right','bundler'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => ' '
));
register_sidebar(array(
'id' => 'footer1',
'name' => esc_html__('Footer sidebar 1','bundler'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => ' '
));
register_sidebar(array(
'id' => 'footer2',
'name' => esc_html__('Footer sidebar 2','bundler'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => ' '
));
register_sidebar(array(
'id' => 'footer3',
'name' => esc_html__('Footer sidebar 3','bundler'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => ' '
));
// Responsive walker menu
class bundler_Walker_Responsive_Menu extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
global $wp_query;
$item_output = $attributes = $prepend ='';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$class_names = join( ' ', apply_filters( '', array_filter( $classes ), $item ) );
$class_names = ' class="'. esc_attr( $class_names ) . '"';
// Create a visual indent in the list if we have a child item.
$visual_indent = ( $depth ) ? str_repeat(' ', $depth) : '';
// Load the item URL
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
// If we have hierarchy for the item, add the indent, if not, leave it out.
// Loop through and output each menu item as this.
if($depth != 0) {
$item_output .= ' ' . $item->title. ' ';
} else {
$item_output .= ''.$prepend.$item->title.' ';
}
// Make the output happen.
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
// Main walker menu
class bundler_Walker_Main_Menu extends Walker_Nav_Menu
{
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
$this->curItem = $item;
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = ' class="'. esc_attr( $class_names ) . '"';
$image = ! empty( $item->custom ) ? ' ' : '';
$output .= $indent . '';
$attributes_title = ! empty( $item->attr_title ) ? ' ' : '';
$attributes = ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$prepend = '';
$append = '';
if($depth != 0)
{
$append = $prepend = '';
}
$item_output = $args->before;
$item_output .= '';
$item_output .= $attributes_title.$args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;
$item_output .= $args->link_after;
$item_output .= ' ';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
}
/*-----------------------------------------------------------------------------------*/
// Options Framework
/*-----------------------------------------------------------------------------------*/
// Paths to admin functions
define('ADMIN_PATH', get_template_directory() . '/admin/');
define('BOX_PATH', get_template_directory() . '/includes/boxes/');
define('ADMIN_DIR', get_template_directory_uri() . '/admin/');
define('LAYOUT_PATH', ADMIN_PATH . '/layouts/');
define('OPTIONS', 'of_options_pmc'); // Name of the database row where your options are stored
require_once (get_template_directory() . '/admin/import/plugins/options-importer.php'); // Options panel settings and custom settings
add_option('IMPORT', 'false');
if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
//Call action that sets
if(get_option('IMPORT') == 'false'){
import(get_template_directory() . '/admin/import/options.json');
update_option('IMPORT', 'true');
wp_redirect( esc_url_raw(admin_url( 'themes.php?page=optionsframework&import=false' )) );
}
else{
wp_redirect( esc_url_raw(admin_url( 'themes.php?page=optionsframework' )) );
}
}
// Build Options
require_once (get_template_directory() . '/admin/theme-options.php'); // Options panel settings and custom settings
require_once (get_template_directory() . '/admin/admin-interface.php'); // Admin Interfaces
require_once (get_template_directory() . '/admin/admin-functions.php'); // Theme actions based on options settings
$includes = get_template_directory() . '/includes/';
$widget_includes = get_template_directory() . '/includes/widgets/';
/* include custom widgets */
require_once ($widget_includes . 'recent_post_widget.php');
require_once ($widget_includes . 'popular_post_widget.php');
require_once ($widget_includes . 'social_widget.php');
require_once ($widget_includes . 'deals_widget.php');
/* include scripts */
function bundler_scripts() {
global $bundler_data;
/*scripts*/
wp_enqueue_script('fitvideos', get_template_directory_uri() . '/js/jquery.fitvids.js', array('jquery'),true,true);
wp_enqueue_script('scrollto', get_template_directory_uri() . '/js/jquery.scrollTo.js', array('jquery'),true,true);
wp_enqueue_script('retinaimages', get_template_directory_uri() . '/js/retina.min.js', array('jquery'),true,true);
wp_enqueue_script('bundler_customjs', get_template_directory_uri() . '/js/custom.js', array('jquery'),true,true);
wp_enqueue_script('prettyphoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array('jquery'),true,true);
wp_enqueue_script('easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', array('jquery'),true,true);
wp_enqueue_script('cycle', get_template_directory_uri() . '/js/jquery.cycle.all.min.js', array('jquery'),true,true);
wp_register_script('news', get_template_directory_uri() . '/js/jquery.li-scroller.1.0.js', array('jquery'),true,true);
wp_enqueue_script('gistfile', get_template_directory_uri() . '/js/gistfile_pmc.js', array('jquery') ,true,true);
wp_enqueue_script('bxSlider', get_template_directory_uri() . '/js/jquery.bxslider.js', array('jquery') ,true,false);
/*style*/
wp_enqueue_style( 'main', get_stylesheet_uri(), 'style');
wp_enqueue_style( 'prettyphoto', get_template_directory_uri() . '/css/prettyPhoto.css', 'style');
/*style*/
wp_enqueue_style( 'main', get_stylesheet_uri(), 'style');
if(isset($bundler_data['body_font'])){
if(($bundler_data['body_font']['face'] != 'verdana') and ($bundler_data['body_font']['face'] != 'trebuchet') and
($bundler_data['body_font']['face'] != 'georgia') and ($bundler_data['body_font']['face'] != 'Helvetica Neue') and
($bundler_data['body_font']['face'] != 'times,tahoma') and ($bundler_data['body_font']['face'] != 'arial')) {
if(isset($bundler_data['google_body_custom']) && $bundler_data['google_body_custom'] != ''){
$font_explode = explode(' ' , $bundler_data['google_body_custom']);
$font_body = '';
$size = count($font_explode);
$count = 0;
if(count($font_explode) > 0){
foreach($font_explode as $font){
if($count < $size-1){
$font_body .= $font_explode[$count].'+';
}
else{
$font_body .= $font_explode[$count];
}
$count++;
}
}else{
$font_body = $bundler_data['google_body_custom'];
}
}else{
$font_body = $bundler_data['body_font']['face'];
}
wp_enqueue_style('googleFontbody', 'https://fonts.googleapis.com/css?family='.$font_body ,'',NULL);
}
}
if(isset($bundler_data['heading_font'])){
if(($bundler_data['heading_font']['face'] != 'verdana') and ($bundler_data['heading_font']['face'] != 'trebuchet') and
($bundler_data['heading_font']['face'] != 'georgia') and ($bundler_data['heading_font']['face'] != 'Helvetica Neue') and
($bundler_data['heading_font']['face'] != 'times,tahoma') and ($bundler_data['heading_font']['face'] != 'arial')) {
if(isset($bundler_data['google_heading_custom']) && $bundler_data['google_heading_custom'] != ''){
$font_explode = explode(' ' , $bundler_data['google_heading_custom']);
$font_heading = '';
$size = count($font_explode);
$count = 0;
if(count($font_explode) > 0){
foreach($font_explode as $font){
if($count < $size-1){
$font_heading .= $font_explode[$count].'+';
}
else{
$font_heading .= $font_explode[$count];
}
$count++;
}
}else{
$font_heading = $bundler_data['google_heading_custom'];
}
}else{
$font_heading = $bundler_data['heading_font']['face'];
}
wp_enqueue_style('googleFontHeading', 'https://fonts.googleapis.com/css?family='.$font_heading ,'',NULL);
}
}
if(isset($bundler_data['menu_font']['face'])){
if(($bundler_data['menu_font']['face'] != 'verdana') and ($bundler_data['menu_font']['face'] != 'trebuchet') and
($bundler_data['menu_font']['face']!= 'georgia') and ($bundler_data['menu_font']['face'] != 'Helvetica Neue') and
($bundler_data['menu_font']['face'] != 'times,tahoma') and ($bundler_data['menu_font']['face'] != 'arial')) {
if(isset($bundler_data['google_menu_custom']) && $bundler_data['google_menu_custom'] != ''){
$font_explode = explode(' ' , $bundler_data['google_menu_custom']);
$font_menu = '';
$size = count($font_explode);
$count = 0;
if(count($font_explode) > 0){
foreach($font_explode as $font){
if($count < $size-1){
$font_menu .= $font_explode[$count].'+';
}
else{
$font_menu .= $font_explode[$count];
}
$count++;
}
}else{
$font_menu = $bundler_data['google_menu_custom'];
}
}else{
$font_menu = $bundler_data['menu_font']['face'];
}
wp_enqueue_style('googleFontMenu', 'https://fonts.googleapis.com/css?family='.$font_menu ,'',NULL);
}
}
/* FONT FOR QUOTE */
if(isset($bundler_data['google_quote_custom']) && $bundler_data['google_quote_custom'] != ''){
$font_explode = explode(' ' , $bundler_data['google_quote_custom']);
$font_quote = '';
$size = count($font_explode);
$count = 0;
if(count($font_explode) > 0){
foreach($font_explode as $font){
if($count < $size-1){
$font_quote .= $font_explode[$count].'+';
}
else{
$font_quote .= $font_explode[$count];
}
$count++;
}
}else{
$font_quote = $bundler_data['google_quote_custom'];
}
}else{
$font_quote = $bundler_data['google_quote_custom']['face'];
}
wp_enqueue_style('googleFontQuote', 'https://fonts.googleapis.com/css?family='.$font_quote ,'',NULL);
wp_enqueue_style('font-awesome_pms', get_template_directory_uri() . '/css/font-awesome.css' ,'',NULL);
wp_enqueue_style('options', get_stylesheet_directory_uri() . '/css/options.css', 'style');
}
add_action( 'wp_enqueue_scripts', 'bundler_scripts' );
/*add boxed to body class*/
add_filter('body_class','bundler_body_class');
function bundler_body_class($classes) {
global $bundler_data;
$class = '';
if(isset($bundler_data['use_boxed'])){
$classes[] = 'bundler_boxed';
}
return $classes;
}
/* custom breadcrumb */
function bundler_breadcrumb($title = false) {
global $bundler_data;
$breadcrumb = '';
if (!is_home()) {
if($title == false){
$breadcrumb .= '';
$breadcrumb .= esc_html__('Home', 'bundler');
$breadcrumb .= " » ";
}
if (is_single()) {
if (is_single()) {
$name = '';
if(!get_query_var($bundler_data['port_slug']) && !get_query_var('product')){
$category = get_the_category(); +
$category_id = get_cat_ID($category[0]->cat_name);
$category_link = get_category_link($category_id);
$name = ''.$category[0]->cat_name .' ';
}
else{
$taxonomy = 'portfoliocategory';
$entrycategory = get_the_term_list( get_the_ID(), $taxonomy, '', ',', '' );
$catstring = $entrycategory;
$catidlist = explode(",", $catstring);
$name = $catidlist[0];
}
if($title == false){
$breadcrumb .= $name .' » '. get_the_title().' ';
}
else{
$breadcrumb .= get_the_title();
}
}
} elseif (is_page()) {
$breadcrumb .= ''.get_the_title().' ';
}
elseif(get_query_var('portfoliocategory')){
$term = get_term_by('slug', get_query_var('portfoliocategory'), 'portfoliocategory'); $name = $term->name;
$breadcrumb .= ''.$name.' ';
}
else if(is_tag()){
$tag = get_query_var('tag');
$tag = str_replace('-',' ',$tag);
$breadcrumb .= ''.$tag.' ';
}
else if(is_search()){
$breadcrumb .= esc_html__('Search results for ', 'bundler') .'"'.get_search_query().' "';
}
else if(is_category()){
$cat = get_query_var('cat');
$cat = get_category($cat);
$breadcrumb .= ''.$cat->name.' ';
}
else if(is_archive()){
$breadcrumb .= ''.esc_html__('Archive','bundler').' ';
}
else{
$breadcrumb .= esc_html__('Home','bundler');
}
}
return $breadcrumb ;
}
/* social share links */
function bundler_socialLinkSingle($link,$title) {
$social = '';
$social .= '';
echo $social;
}
/* links to social profile */
function bundler_socialLink() {
$social = '';
global $bundler_data;
$icons = $bundler_data['socialicons'];
if(is_array($icons)){
foreach ($icons as $icon){
$social .= ' ';
}
}
echo $social;
}
add_filter('the_content', 'bundler_addlightbox');
/* add lightbox to images*/
function bundler_addlightbox($content)
{ global $post;
$pattern = "//i";
$replacement = ' ';
$content = preg_replace($pattern, $replacement, $content);
if(isset($post->ID))
$content = str_replace("%LIGHTID%", $post->ID, $content);
return $content;
}
/* remove double // char */
function bundler_stripText($string)
{
return str_replace("\\",'',$string);
}
/* custom post types */
add_action('save_post', 'bundler_update_post_type');
add_action("admin_init", "bundler_add_meta_box");
add_action("admin_init", "bundler_add_meta_box_sidebar");
function bundler_add_meta_box_sidebar(){
add_meta_box("bundler_post_sidebar", "Image options", "bundler_post_sidebar", "post", "side", "high");
}
function bundler_post_sidebar(){
global $post;
$bundler_data = get_post_custom(get_the_id());
if (isset($bundler_data["bundler_featured_category"][0])){
$bundler_featured_category = $bundler_data["bundler_featured_category"][0];
}else{
$bundler_featured_category = 1;
$bundler_data["bundler_featured_category"][0] = 1;
}
if (isset($bundler_data["bundler_featured_post"][0])){
$bundler_featured_post = $bundler_data["bundler_featured_post"][0];
}else{
$bundler_featured_post = 1;
$bundler_data["bundler_featured_post"][0] = 1;
}
?>
ID, "video_post_url", $_POST["video_post_url"]);
}
if( isset($_POST["link_post_url"]) ) {
update_post_meta($post->ID, "link_post_url", $_POST["link_post_url"]);
}
if( isset($_POST["audio_post_url"]) ) {
update_post_meta($post->ID, "audio_post_url", $_POST["audio_post_url"]);
}
if( isset($_POST["bundler_featured_category"]) ) {
update_post_meta($post->ID, "bundler_featured_category", $_POST["bundler_featured_category"]);
}else{
update_post_meta($post->ID, "bundler_featured_category", 0);
}
if( isset($_POST["bundler_featured_post"]) ) {
update_post_meta($post->ID, "bundler_featured_post", $_POST["bundler_featured_post"]);
}else{
update_post_meta($post->ID, "bundler_featured_post", 0);
}
if( isset($_POST["subtitle"]) ) {
update_post_meta($post->ID, "subtitle", $_POST["subtitle"]);
}
}
}
if( !function_exists( 'Bundler_fallback_menu' ) )
{
function Bundler_fallback_menu()
{
$current = "";
if (is_front_page()){$current = "class='current-menu-item'";}
echo "";
}
}
add_filter( 'the_category', 'bundler_add_nofollow_cat' );
function bundler_add_nofollow_cat( $text ) {
$text = str_replace('rel="category tag"', "", $text);
return $text;
}
/* get image from post */
function bundler_getImage($id, $image){
$return = '';
if ( has_post_thumbnail() ){
$return = get_the_post_thumbnail($id,$image);
}
else
$return = '';
return $return;
}
if ( ! isset( $content_width ) ) $content_width = 800;
function bundler_add_this_script_footer(){
global $bundler_data;
?>
array('src' => array()),'a' => array('href' => array()),'span' => array(),'div' => array('class' => array()),'b' => array(),'strong' => array(),'br' => array(),'p' => array())));
}
/* SEARCH FORM */
function bundler_search_form( $form ) {
$form = '';
return $form;
}
add_filter( 'get_search_form', 'bundler_search_form' );
add_action('save_post', 'bundler_update_post_rev');
add_action("admin_init", "bundler_add_rev");
function bundler_add_rev(){
$screens = array( 'post', 'page' );
foreach ( $screens as $screen ) {
add_meta_box(
"bundler_post_content", "Bundler Options", "bundler_post_content",
$screen,'side','high'
);
}
}
function bundler_post_content(){
global $post;
$bundler_data = get_post_custom(get_the_id());
if (isset($bundler_data["custom_post_rev"][0])){
$custom_post_rev = $bundler_data["custom_post_rev"][0];
}else{
$custom_post_rev = "";
}
global $wp_registered_sidebars;
if (isset($bundler_data["sidebar"][0])){
$sidebar = $bundler_data["sidebar"][0];
}else{
$sidebar = "";
} ?>
Select custom revolution slider:
>Empty
getArrSliders();
if(!empty($arrSliders)){
$revSliderArray = array();
foreach($arrSliders as $sliders){ ?>
getAlias() == $custom_post_rev) echo 'selected'; ?>>
getShowTitle() ?>
ID, "custom_post_rev", $_POST["custom_post_rev"]);
}
if( isset($_POST["sidebar"]) ) {
update_post_meta($post->ID, "sidebar", $_POST["sidebar"]);
}
}
}
/*the_excerpt*/
function bundler_excerpt_length( $length ) {
global $bundler_data;
if(isset($bundler_data['grid_blog'])){
switch($bundler_data['grid_blog']){
case 2:
return 45;
break;
case 3:
return 30;
break;
}
}
else {
return 30;
}
}
add_filter( 'excerpt_length', 'bundler_excerpt_length', 999 );
add_filter( 'the_content_more_link', 'bundler_modify_read_more_link' );
function bundler_modify_read_more_link() {
return '';
}
global $bundler_data;
add_filter('dynamic_sidebar_params','bundler_blog_widgets');
/* Register our callback function */
function bundler_blog_widgets($params) {
global $blog_widget_num; //Our widget counter variable
//Check if we are displaying "Footer Sidebar"
if(isset($params[0]['id']) && $params[0]['id'] == 'sidebar-delas-blog'){
$blog_widget_num++;
$divider = 2; //This is number of widgets that should fit in one row
//If it's third widget, add last class to it
if($blog_widget_num % $divider == 0){
$class = 'class="last ';
$params[0]['before_widget'] = str_replace('class="', $class, $params[0]['before_widget']);
}
}
return $params;
}?>