initial commit

This commit is contained in:
2024-04-29 13:12:44 +05:45
commit 34887303c5
19300 changed files with 5268802 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,165 @@
<?php
/**
* Class Name: wp_bootstrap_navwalker
* GitHub URI: https://github.com/twittem/wp-bootstrap-navwalker
* Description: A custom WordPress nav walker class to implement the Twitter Bootstrap 2.3.2 navigation style in a custom theme using the WordPress built in menu manager.
* Version: 2.0.2
* Author: Edward McIntyre - @twittem
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
class wp_bootstrap_navwalker extends Walker_Nav_Menu {
/**
* @see Walker::start_lvl()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of page. Used for padding.
*/
function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<div class=\"dropdown-menu\">\n";
}
/**
* @see Walker::start_el()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param int $current_page Menu item ID.
* @param object $args
*/
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
/**
* Dividers, Headers or Disabled
* =============================
* Determine whether the item is a Divider, Header, Disabled or regular
* menu item. To prevent errors we use the strcasecmp() function to so a
* comparison that is not case sensitive. The strcasecmp() function returns
* a 0 if the strings are equal.
*/
if (strcasecmp($item->attr_title, 'divider') == 0 && $depth === 1) {
$output .= $indent . '<li role="presentation" class="divider">';
} else if (strcasecmp($item->attr_title, 'dropdown-header') == 0 && $depth === 1) {
$output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title );
} else if (strcasecmp($item->attr_title, 'disabled') == 0) {
$output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>';
} else {
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
//Start Modification
if($args->has_children) {
if($depth>0){
$class_names .= ' dropdown sub-menu';
} else {
$class_names .= ' dropdown';
}
}
if(in_array('current-menu-parent', $classes)) { $class_names .= ' active'; }
if(in_array('current_page_parent', $classes)) { $class_names .= ' active'; }
//End modification
if(in_array('current-menu-item', $classes)) { $class_names .= ' active'; }
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '<li' . $id . $value . $class_names .'>';
$atts = array();
$atts['title'] = ! empty( $item->title ) ? $item->title : '';
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
$atts['class'] = 'nav-link';
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
$attributes = '';
foreach ( $atts as $attr => $value ) {
if ( ! empty( $value ) ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$item_output = $args->before;
/*
* Glyphicons
* ===========
* Since the the menu item is NOT a Divider or Header we check the see
* if there is a value in the attr_title property. If the attr_title
* property is NOT null we apply it as the class name for the glyphicon.
*/
if(! empty( $item->attr_title )){
$item_output .= '<a'. $attributes .'><span class="glyphicon ' . esc_attr( $item->attr_title ) . '"></span>&nbsp;';
} else {
$item_output .= '<a'. $attributes .'>';
}
$caret = ($depth === 0) ? 'down' : 'right';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= ($args->has_children) ? ' <i class="icon-angle-' . $caret . '"></i></a>' : '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
/**
* Traverse elements to create list from elements.
*
* Display one element if the element doesn't have any children otherwise,
* display the element and its children. Will only traverse up to the max
* depth and no ignore elements under that depth.
*
* This method shouldn't be called directly, use the walk() method instead.
*
* @see Walker::start_el()
* @since 2.5.0
*
* @param object $element Data object
* @param array $children_elements List of elements to continue traversing.
* @param int $max_depth Max depth to traverse.
* @param int $depth Depth of current element.
* @param array $args
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
if ( !$element ) {
return;
}
$id_field = $this->db_fields['id'];
//display this element
if ( is_object( $args[0] ) ) {
$args[0]->has_children = ! empty( $children_elements[$element->$id_field] );
}
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
}

View File

@@ -0,0 +1,64 @@
<?php
//breadcrumb
function zee_breadcrumb(){
ob_start();
?>
<ul class="breadcrumb pull-right">
<li>
<a href="<?php home_url(); ?>" class="breadcrumb_home"><?php esc_html_e('Home',ZEETEXTDOMAIN) ?></a>
</li>
<li class="active">
<?php if( is_tag() ) { ?>
<?php esc_html_e('Posts Tagged ',ZEETEXTDOMAIN) ?><span class="raquo">/</span><?php single_tag_title(); echo('/'); ?>
<?php } elseif (is_day()) { ?>
<?php esc_html_e('Posts made in',ZEETEXTDOMAIN) ?> <?php the_time('F jS, Y'); ?>
<?php } elseif (is_month()) { ?>
<?php esc_html_e('Posts made in',ZEETEXTDOMAIN) ?> <?php the_time('F, Y'); ?>
<?php } elseif (is_year()) { ?>
<?php esc_html_e('Posts made in',ZEETEXTDOMAIN) ?> <?php the_time('Y'); ?>
<?php } elseif (is_search()) { ?>
<?php esc_html_e('Search results for',ZEETEXTDOMAIN) ?> <?php the_search_query() ?>
<?php } elseif (is_single()) { ?>
<?php $category = get_the_category();
if ( $category ) {
$catlink = get_category_link( $category[0]->cat_ID );
echo ('<a href="'.esc_url($catlink).'">'.esc_html($category[0]->cat_name).'</a> '.'<span class="raquo">/</span> ');
}
echo get_the_title(); ?>
<?php } elseif (is_category()) { ?>
<?php single_cat_title(); ?>
<?php } elseif (is_tax()) { ?>
<?php
$zee_taxonomy_links = array();
$zee_term = get_queried_object();
$zee_term_parent_id = $zee_term->parent;
$zee_term_taxonomy = $zee_term->taxonomy;
while ( $zee_term_parent_id ) {
$zee_current_term = get_term( $zee_term_parent_id, $zee_term_taxonomy );
$zee_taxonomy_links[] = '<a href="' . esc_url( get_term_link( $zee_current_term, $zee_term_taxonomy ) ) . '" title="' . esc_attr( $zee_current_term->name ) . '">' . esc_html( $zee_current_term->name ) . '</a>';
$zee_term_parent_id = $zee_current_term->parent;
}
if ( !empty( $zee_taxonomy_links ) ) echo implode( ' <span class="raquo">/</span> ', array_reverse( $zee_taxonomy_links ) ) . ' <span class="raquo">/</span> ';
echo esc_html( $zee_term->name );
} elseif (is_author()) {
global $wp_query;
$curauth = $wp_query->get_queried_object();
esc_html_e('Posts by ',ZEETEXTDOMAIN); echo ' ',$curauth->nickname;
} elseif (is_page()) {
echo get_the_title();
} elseif (is_home()) {
esc_html_e('Blog',ZEETEXTDOMAIN);
} ?>
</li>
</ul>
<?php
return ob_get_clean();
}

View File

@@ -0,0 +1,175 @@
<?php
/**
* Class Name: wp_bootstrap_navwalker
* GitHub URI: https://github.com/twittem/wp-bootstrap-navwalker
* Description: A custom WordPress nav walker class to implement the Twitter Bootstrap 2.3.2 navigation style in a custom theme using the WordPress built in menu manager.
* Version: 2.0.2
* Author: Edward McIntyre - @twittem
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
class wp_bootstrap_mobile_navwalker extends Walker_Nav_Menu {
private $current_Item;
/**
* @see Walker::start_lvl()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of page. Used for padding.
*/
function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
if( $args->has_children ){
$output .= "\n$indent<ul role=\"menu\" class=\"collapse collapse-".$this->current_Item->ID." \">\n";
}
}
/**
* @see Walker::start_el()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param int $current_page Menu item ID.
* @param object $args
*/
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$this->current_Item = $item;
/**
* Dividers, Headers or Disabled
* =============================
* Determine whether the item is a Divider, Header, Disabled or regular
* menu item. To prevent errors we use the strcasecmp() function to so a
* comparison that is not case sensitive. The strcasecmp() function returns
* a 0 if the strings are equal.
*/
if (strcasecmp($item->attr_title, 'divider') == 0 && $depth === 1) {
$output .= $indent . '<li role="presentation" class="divider">';
} else if (strcasecmp($item->attr_title, 'dropdown-header') == 0 && $depth === 1) {
$output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title );
} else if (strcasecmp($item->attr_title, 'disabled') == 0) {
$output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>';
} else {
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
//Start Modification
if($args->has_children && $depth>0 ) $class_names .= ' dropdown ';
if(in_array('current-menu-parent', $classes)) { $class_names .= ' active'; }
if(in_array('current_page_parent', $classes)) { $class_names .= ' active'; }
//End modification
if(in_array('current-menu-item', $classes)) { $class_names .= ' active'; }
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '<li' . $id . $value . $class_names .'>';
$atts = array();
$atts['title'] = ! empty( $item->title ) ? $item->title : '';
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
$attributes = '';
foreach ( $atts as $attr => $value ) {
if ( ! empty( $value ) ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$item_output = $args->before;
/*
* Glyphicons
* ===========
* Since the the menu item is NOT a Divider or Header we check the see
* if there is a value in the attr_title property. If the attr_title
* property is NOT null we apply it as the class name for the glyphicon.
*/
if(! empty( $item->attr_title )){
$item_output .= '<a'. $attributes .'><span class="glyphicon ' . esc_attr( $item->attr_title ) . '"></span>&nbsp;';
} else {
$item_output .= '<a'. $attributes .'>';
}
$caret = ($depth === 0) ? 'down' : 'right';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
if($args->has_children) {
$item_output .= '
<span class="menu-toggler" data-toggle="collapse" data-target=".collapse-'.$item->ID.'">
<i class="icon-angle-right"></i><i class="icon-angle-down"></i>
</span>';
}
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
/**
* Traverse elements to create list from elements.
*
* Display one element if the element doesn't have any children otherwise,
* display the element and its children. Will only traverse up to the max
* depth and no ignore elements under that depth.
*
* This method shouldn't be called directly, use the walk() method instead.
*
* @see Walker::start_el()
* @since 2.5.0
*
* @param object $element Data object
* @param array $children_elements List of elements to continue traversing.
* @param int $max_depth Max depth to traverse.
* @param int $depth Depth of current element.
* @param array $args
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
if ( !$element ) {
return;
}
$id_field = $this->db_fields['id'];
//display this element
if ( is_object( $args[0] ) ) {
$args[0]->has_children = ! empty( $children_elements[$element->$id_field] );
}
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
}

View File

@@ -0,0 +1,185 @@
<?php
/**
*
* Adapted from Edward McIntyre's wp_bootstrap_navwalker class.
* Removed support for glyphicon and added support for Font Awesome
*
*/
/**
* Class Name: wp_bootstrap_navwalker
* GitHub URI: https://github.com/twittem/wp-bootstrap-navwalker
* Description: A custom WordPress nav walker class to implement the Bootstrap 3 navigation style in a custom theme using the WordPress built in menu manager.
* Version: 2.0.4
* Author: Edward McIntyre - @twittem
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
//exit if accessed directly
if(!defined('ABSPATH')) exit;
class wp_bootstrap_navwalker extends Walker_Nav_Menu {
/**
* @see Walker::start_lvl()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of page. Used for padding.
*/
public function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n";
}
/**
* @see Walker::start_el()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param int $current_page Menu item ID.
* @param object $args
*/
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
/**
* Dividers, Headers or Disabled
* =============================
* Determine whether the item is a Divider, Header, Disabled or regular
* menu item. To prevent errors we use the strcasecmp() function to so a
* comparison that is not case sensitive. The strcasecmp() function returns
* a 0 if the strings are equal.
*/
if ( strcasecmp( $item->attr_title, 'divider' ) == 0 && $depth === 1 ) {
$output .= $indent . '<li role="presentation" class="divider">';
} else if ( strcasecmp( $item->title, 'divider') == 0 && $depth === 1 ) {
$output .= $indent . '<li role="presentation" class="divider">';
} else if ( strcasecmp( $item->attr_title, 'dropdown-header') == 0 && $depth === 1 ) {
$output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title );
} else if ( strcasecmp($item->attr_title, 'disabled' ) == 0 ) {
$output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>';
} else {
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
/*
if ( $args->has_children )
$class_names .= ' dropdown';
*/
if($args->has_children && $depth === 0) { $class_names .= ' dropdown'; } elseif($args->has_children && $depth > 0) { $class_names .= ' dropdown-submenu'; }
if ( in_array( 'current-menu-item', $classes ) )
$class_names .= ' current';
// remove Font Awesome icon from classes array and save the icon
// we will add the icon back in via a <span> below so it aligns with
// the menu item
if ( in_array('fa', $classes)) {
$key = array_search('fa', $classes);
$icon = $classes[$key + 1];
$class_names = str_replace($classes[$key+1], '', $class_names);
$class_names = str_replace($classes[$key], '', $class_names);
}
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '<li' . $id . $value . $class_names .'>';
$atts = array();
$atts['title'] = ! empty( $item->title ) ? $item->title : '';
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
// If item has_children add atts to a.
// if ( $args->has_children && $depth === 0 ) {
if ( $args->has_children && $depth === 0 ) {
$atts['href'] = ! empty( $item->url ) ? $item->url : ''; // new line
$atts['data-toggle'] = 'dropdown';
$atts['class'] = 'dropdown-toggle';
$atts['aria-haspopup'] = 'true';
} else {
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
}
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
$attributes = '';
foreach ( $atts as $attr => $value ) {
if ( ! empty( $value ) ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$item_output = $args->before;
// Font Awesome icons
if ( ! empty( $icon ) )
$item_output .= '<a'. $attributes .'><span class="fa ' . esc_attr( $icon ) . '"></span>&nbsp;';
else
$item_output .= '<a'. $attributes .'>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
/**
* Traverse elements to create list from elements.
*
* Display one element if the element doesn't have any children otherwise,
* display the element and its children. Will only traverse up to the max
* depth and no ignore elements under that depth.
*
* This method shouldn't be called directly, use the walk() method instead.
*
* @see Walker::start_el()
* @since 2.5.0
*
* @param object $element Data object
* @param array $children_elements List of elements to continue traversing.
* @param int $max_depth Max depth to traverse.
* @param int $depth Depth of current element.
* @param array $args
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
if ( ! $element )
return;
$id_field = $this->db_fields['id'];
// Display this element.
if ( is_object( $args[0] ) )
$args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] );
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
}
/**
* Menu Fallback
* =============
* If this function is assigned to the wp_nav_menu's fallback_cb variable
* and a manu has not been assigned to the theme location in the WordPress
* menu manager the function with display nothing to a non-logged in user,
* and will add a link to the WordPress menu manager if logged in as an admin.
*
* @param array $args passed from the wp_nav_menu function.
*
*/
public static function fallback( $args ) {
if ( current_user_can( 'manage_options' ) ) {
extract( $args );
$fb_output = null;
if ( $container ) {
$fb_output = '<' . $container;
if ( $container_id )
$fb_output .= ' id="' . $container_id . '"';
if ( $container_class )
$fb_output .= ' class="' . $container_class . '"';
$fb_output .= '>';
}
$fb_output .= '<ul';
if ( $menu_id )
$fb_output .= ' id="' . $menu_id . '"';
if ( $menu_class )
$fb_output .= ' class="' . $menu_class . '"';
$fb_output .= '>';
$fb_output .= '<li><a href="' . admin_url( 'nav-menus.php' ) . '">Add a menu</a></li>';
$fb_output .= '</ul>';
if ( $container )
$fb_output .= '</' . $container . '>';
echo $fb_output;
}
}
}

View File

@@ -0,0 +1,162 @@
<?php
/*******************************************************************
* @Author: Boutros AbiChedid
* @Date: March 20, 2011
* @Websites: http://bacsoftwareconsulting.com/
* http://blueoliveonline.com/
* @Description: Numbered Page Navigation (Pagination) Code.
* @Tested: Up to WordPress version 3.1.2 (also works on WP 3.3.1)
********************************************************************/
/* Function that Rounds To The Nearest Value.
Needed for the pagenavi() function */
function round_num($num, $to_nearest) {
/*Round fractions down (http://php.net/manual/en/function.floor.php)*/
return floor($num/$to_nearest)*$to_nearest;
}
/* Function that performs a Boxed Style Numbered Pagination (also called Page Navigation).
Function is largely based on Version 2.4 of the WP-PageNavi plugin */
function pagenavi($before = '', $after = '') {
global $wpdb, $wp_query;
$pagenavi_options = array();
$pagenavi_options['pages_text'] = ('Page %CURRENT_PAGE% of %TOTAL_PAGES%:');
$pagenavi_options['current_text'] = '%PAGE_NUMBER%';
$pagenavi_options['page_text'] = '%PAGE_NUMBER%';
$pagenavi_options['first_text'] = ('First Page');
$pagenavi_options['last_text'] = ('Last Page');
$pagenavi_options['next_text'] = 'Next &raquo;';
$pagenavi_options['prev_text'] = '&laquo; Previous';
$pagenavi_options['dotright_text'] = '...';
$pagenavi_options['dotleft_text'] = '...';
$pagenavi_options['num_pages'] = 5; //continuous block of page numbers
$pagenavi_options['always_show'] = 0;
$pagenavi_options['num_larger_page_numbers'] = 0;
$pagenavi_options['larger_page_numbers_multiple'] = 5;
//If NOT a single Post is being displayed
/*http://codex.wordpress.org/Function_Reference/is_single)*/
if (!is_single()) {
$request = $wp_query->request;
//intval — Get the integer value of a variable
/*http://php.net/manual/en/function.intval.php*/
$posts_per_page = intval(get_query_var('posts_per_page'));
//Retrieve variable in the WP_Query class.
/*http://codex.wordpress.org/Function_Reference/get_query_var*/
$paged = intval(get_query_var('paged'));
$numposts = $wp_query->found_posts;
$max_page = $wp_query->max_num_pages;
//empty — Determine whether a variable is empty
/*http://php.net/manual/en/function.empty.php*/
if(empty($paged) || $paged == 0) {
$paged = 1;
}
$pages_to_show = intval($pagenavi_options['num_pages']);
$larger_page_to_show = intval($pagenavi_options['num_larger_page_numbers']);
$larger_page_multiple = intval($pagenavi_options['larger_page_numbers_multiple']);
$pages_to_show_minus_1 = $pages_to_show - 1;
$half_page_start = floor($pages_to_show_minus_1/2);
//ceil — Round fractions up (http://us2.php.net/manual/en/function.ceil.php)
$half_page_end = ceil($pages_to_show_minus_1/2);
$start_page = $paged - $half_page_start;
if($start_page <= 0) {
$start_page = 1;
}
$end_page = $paged + $half_page_end;
if(($end_page - $start_page) != $pages_to_show_minus_1) {
$end_page = $start_page + $pages_to_show_minus_1;
}
if($end_page > $max_page) {
$start_page = $max_page - $pages_to_show_minus_1;
$end_page = $max_page;
}
if($start_page <= 0) {
$start_page = 1;
}
$larger_per_page = $larger_page_to_show*$larger_page_multiple;
//round_num() custom function - Rounds To The Nearest Value.
$larger_start_page_start = (round_num($start_page, 10) + $larger_page_multiple) - $larger_per_page;
$larger_start_page_end = round_num($start_page, 10) + $larger_page_multiple;
$larger_end_page_start = round_num($end_page, 10) + $larger_page_multiple;
$larger_end_page_end = round_num($end_page, 10) + ($larger_per_page);
if($larger_start_page_end - $larger_page_multiple == $start_page) {
$larger_start_page_start = $larger_start_page_start - $larger_page_multiple;
$larger_start_page_end = $larger_start_page_end - $larger_page_multiple;
}
if($larger_start_page_start <= 0) {
$larger_start_page_start = $larger_page_multiple;
}
if($larger_start_page_end > $max_page) {
$larger_start_page_end = $max_page;
}
if($larger_end_page_end > $max_page) {
$larger_end_page_end = $max_page;
}
if($max_page > 1 || intval($pagenavi_options['always_show']) == 1) {
/*http://php.net/manual/en/function.str-replace.php */
/*number_format_i18n(): Converts integer number to format based on locale (wp-includes/functions.php*/
$pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $pagenavi_options['pages_text']);
$pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text);
echo $before.'<div class="pagenavi">'."\n";
if(!empty($pages_text)) {
echo '<span class="pages">'.$pages_text.'</span>';
}
//Displays a link to the previous post which exists in chronological order from the current post.
/*http://codex.wordpress.org/Function_Reference/previous_post_link*/
previous_posts_link($pagenavi_options['prev_text']);
if ($start_page >= 2 && $pages_to_show < $max_page) {
$first_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['first_text']);
//esc_url(): Encodes < > & " ' (less than, greater than, ampersand, double quote, single quote).
/*http://codex.wordpress.org/Data_Validation*/
//get_pagenum_link():(wp-includes/link-template.php)-Retrieve get links for page numbers.
echo '<a href="'.esc_url(get_pagenum_link()).'" class="first" title="'.$first_page_text.'">1</a>';
if(!empty($pagenavi_options['dotleft_text'])) {
echo '<span class="expand">'.$pagenavi_options['dotleft_text'].'</span>';
}
}
if($larger_page_to_show > 0 && $larger_start_page_start > 0 && $larger_start_page_end <= $max_page) {
for($i = $larger_start_page_start; $i < $larger_start_page_end; $i+=$larger_page_multiple) {
$page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
echo '<a href="'.esc_url(get_pagenum_link($i)).'" class="single_page" title="'.$page_text.'">'.$page_text.'</a>';
}
}
for($i = $start_page; $i <= $end_page; $i++) {
if($i == $paged) {
$current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['current_text']);
echo '<span class="current">'.$current_page_text.'</span>';
} else {
$page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
echo '<a href="'.esc_url(get_pagenum_link($i)).'" class="single_page" title="'.$page_text.'">'.$page_text.'</a>';
}
}
if ($end_page < $max_page) {
if(!empty($pagenavi_options['dotright_text'])) {
echo '<span class="expand">'.$pagenavi_options['dotright_text'].'</span>';
}
$last_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['last_text']);
echo '<a href="'.esc_url(get_pagenum_link($max_page)).'" class="last" title="'.$last_page_text.'">'.$max_page.'</a>';
}
next_posts_link($pagenavi_options['next_text'], $max_page);
if($larger_page_to_show > 0 && $larger_end_page_start < $max_page) {
for($i = $larger_end_page_start; $i <= $larger_end_page_end; $i+=$larger_page_multiple) {
$page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
echo '<a href="'.esc_url(get_pagenum_link($i)).'" class="single_page" title="'.$page_text.'">'.$page_text.'</a>';
}
}
echo '</div>'.$after."\n";
}
}
}
?>

View File

@@ -0,0 +1,23 @@
<?php
header('Content-type: application/json');
$status = array(
'type'=>'success',
'message'=>'Email sent!'
);
$name = @trim(stripslashes($_POST['name']));
$email = @trim(stripslashes($_POST['email']));
$subject = @trim(stripslashes($_POST['subject']));
$message = @trim(stripslashes($_POST['message']));
$email_from = $email;
$email_to = zee_option('zee_contact_email');
$body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;
$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');
echo json_encode($status);
die;

View File

@@ -0,0 +1,896 @@
<?php
//Button
add_shortcode( 'dc_button', function( $atts, $content= null ){
$atts = shortcode_atts(
array(
'text' => 'Button',
'type' => 'default',
'size' => '',
'url' => '#',
'class' => '',
'icon' => '',
'target'=>'_self'
), $atts);
extract($atts);
$classes = 'btn';
$output = $text;
if($type) $classes .= ' btn-'. $type;
if($size) $classes .= ' btn-'. $size;
if($class) $classes .= ' '. $class;
if($icon) $output = '<i class="' . $icon . '"></i> ' . $text;
return '<a target="' . $target . '" href="' . $url . '" class="' . $classes . '">' . do_shortcode($output) . '</a>';
});
//Alert
add_shortcode( 'dc_alert', function( $atts, $content= null ){
$atts = shortcode_atts(
array(
"type" => 'info',
"close" => 'no',
"title" => '',
), $atts);
//extract($atts);
$output = '<div class="alert'
. (($atts['type']=='none' ) ? '':' alert-'.$atts['type'])
. (($atts['close']=='no' ) ? '':' alert-dismissable')
.' fade in">';
if($atts['close']=='yes' ){
$output .='<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>';
}
if( $atts['title']!='' ){
$output .='<h4>'. $atts['title']. '</h4>';
}
$output .= do_shortcode($content);
$output .='</div>';
return $output;
});
//divider
add_shortcode( 'dc_divider', function( $atts, $content= null ){
$atts = shortcode_atts(
array(
'size' => 'default'
), $atts);
extract($atts);
return '<div class="clearfix ' . $size . ' "></div>';
});
//progressbar
add_shortcode( 'dc_progressbar', function( $atts, $content= null ) {
return '<div>' . do_shortcode( $content ) . '</div>';
});
add_shortcode( 'dc_bar', function( $atts, $content= null ) {
$atts = shortcode_atts(
array(
"style" => '',
"width" => '70%',
"min" => '0',
"max" => '100',
"default" => '70'
), $atts);
extract($atts);
return '<div class="progress">
<div class="progress-bar ' . $style . '" role="progressbar" aria-valuenow="' . $default . '" aria-valuemin="'. $min .'" aria-valuemax="'. $max .'" style="width: ' . $width . '%">
<span>' . do_shortcode( $content ) . '</span>
</div></div>
';
});
//container
add_shortcode( 'dc_container', function( $atts, $content = null ) {
$atts = shortcode_atts(
array(
"class" => '',
'id' => ''
), $atts);
extract($atts);
if($id!='') $id = 'id=' . $id;
return '<section ' . $id . ' class="' . $class . '"><div class="container">' . do_shortcode( $content ) . '</div></section>';
});
// faq
add_shortcode( 'dc_faq', function( $atts=null, $content= null ){
ob_start();
$args = array(
'posts_per_page' => -1,
'post_type'=>'dc_faq',
'orderby' => 'menu_order',
'order' => 'ASC'
);
$posts = get_posts( $args ); ?>
<div class="row">
<ul>
<?php
foreach ($posts as $key => $post) {
?>
<li class="faq">
<div class="media">
<span class="number pull-left"><?php echo $key + 1;?></span>
<div class="media-body">
<h4><?php echo $post->post_title; ?></h4>
<p><?php echo do_shortcode( $post->post_content ); ?></p>
</div>
</div>
</li>
<?php } ?>
</ul>
</div>
<?php
return ob_get_clean();
});
// Service
add_shortcode( 'dc_service', function( $atts, $content= null ){
$atts = shortcode_atts(
array(
"category" => 0,
"column" => 3,
"number" => 3
), $atts);
extract($atts);
ob_start();
$args = array(
'post_type'=>'dc_service',
'orderby' => 'menu_order',
'order' => 'ASC',
'numberposts' => $number,
);
if( $category > 0 ){
$args['tax_query'] = array(
array(
'posts_per_page' => -1,
'taxonomy' => 'cat_service',
'field' => 'term_id',
'terms' => $category
)
);
}
$posts = get_posts( $args ); ?>
<section class="content intro_text_box">
<div class="container">
<div class="row">
<?php foreach ($posts as $key => $post) {
$icon = get_post_meta( $post->ID, 'service_icon', true );
$color = get_post_meta($post->ID, 'service_color', true);
?>
<div class="col-sm-<?php echo (12/$column); ?>" data-effect="slide-left" >
<div class="services">
<?php if( $icon ) { ?>
<div class="icon">
<i class="fa <?php echo str_replace('icon', 'fa',$icon); ?> icon-md"></i>
</div>
<?php } ?>
<div class="serv_detail">
<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="main-post-link">
<?php echo $post->post_title; ?></a></h3>
<?php echo do_shortcode( $post->post_content ); ?>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</section>
<?php
return ob_get_clean();
});
// Product
add_shortcode( 'product', function( $atts, $content= null ){
$atts = shortcode_atts(
array(
"category" => 0,
"column" => 3,
"number" => 3
), $atts);
extract($atts);
ob_start();
$args = array(
'post_type'=>'product',
'orderby' => 'menu_order',
'order' => 'ASC',
'numberposts' => $number,
);
$posts = get_posts( $args ); ?>
<section class="content service_page">
<div class="container">
<div class="row pb_30">
<?php foreach ($posts as $key => $post) {
$icon = get_post_meta( $post->ID, 'service_icon', true );
$color = get_post_meta($post->ID, 'service_color', true);
?>
<div class="col-sm-<?php echo (12/$column); ?>" data-effect="slide-left" >
<div class="services_4">
<div class="service_image">
<?php echo the_post_thumbnail('product_thumb', array('class' => 'img-responsive')); ?></div>
<div class="serv_detail">
<h3><?php echo $post->post_title; ?></h3>
<?php echo do_shortcode( $post->post_content ); ?>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</section>
<?php
return ob_get_clean();
});
// End of product
// Testimonial
add_shortcode( 'dc_testimonial', function( $atts, $content= null ){
$atts = shortcode_atts(
array(
"count" => ''
), $atts);
extract($atts);
ob_start();
$args = array(
'posts_per_page' => -1,
'post_type'=>'dc_testimonial',
'numberposts' => $count,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$posts = get_posts( $args ); ?>
<div class="row">
<?php foreach ($posts as $key => $post) {
?>
<div class="col-sm-6">
<blockquote>
<?php echo do_shortcode( $post->post_content ); ?>
<small class="designation"><?php echo get_post_meta($post->ID, 'testimonial_designation',true) ?></small>
</blockquote>
</div>
<?php } ?>
</div>
<?php
return ob_get_clean();
});
/**
* Portfolio Shortcode
* @param [type] $atts
* @param string $content
* @return [type]
*/
add_shortcode( 'dc_portfolio', function( $atts, $content = null ){
$atts = shortcode_atts(
array(
'column' => '3'
), $atts);
extract($atts);
$args = array(
'posts_per_page' => -1,
'post_type' => 'dc_portfolio'
);
$portfolios = get_posts( $args );
ob_start();
if(count($portfolios)>0){ ?>
<div class="isotope "> <!--begin portfolio filter -->
<ul id="filter" class="option-set clearfix">
<li data-filter="*" class="selected"><a href="#" ><?php _e('All', peepalcomsys); ?></a></li>
<?php
$terms = get_terms('cat_portfolio', array('hide_empty'=> true));
foreach ($terms as $term) {
?>
<li data-filter=".<?php echo $term->slug; ?>" ><a href="#"> <?php echo $term->name; ?></a></li>
<?php
}
?>
</ul>
<!--end portfolio filter --> <!--begin portfolio_list -->
<ul id="list" class="portfolio_list clearfix ">
<?php foreach ($portfolios as $key => $value) { ?>
<?php
$terms = wp_get_post_terms( $value->ID, 'cat_portfolio' );
$new_terms = array();
foreach ($terms as $term) $new_terms[] = $term->slug;
$slugs = implode(' ', $new_terms);
?>
<!--begin col-lg-6 col-md-6 -->
<li class="list_item branding col-md-<?php echo $column; ?> <?php echo $slugs; ?>">
<div class="project_container ">
<div class="img_hover">
<?php
echo get_the_post_thumbnail( $value->ID, array(300,300), array(
'class' => "img-responsive",
'alt' => trim(strip_tags( $value->post_title )),
'title' => trim(strip_tags( $value->post_title ))
));
?>
<a class="hover_link" href=" <?php echo $slugs; ?>"><span><i class="fa fa-link"></i></span></a>
</div>
<div class="project_info">
<h4><a href="portfolio_3.html#"><a href="<?php echo get_permalink( $value->ID ); ?>"><?php echo $value->post_title; ?></a></a> </h4>
<a href="#"><?php $terms = get_the_terms( $portfolio->ID, 'cat_portfolio' );
// var_dump($terms);
foreach($terms as $term) {
echo $term->name;
} ?>
</a> </div>
</div>
</li>
<?php } ?>
</ul>
</div>
<?php } else { ?>
<div class="alert alert-danger fade in">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<?php _e('No portfolio item found!', peepalcomsys); ?>
</div>
<?php
}
return ob_get_clean();
});
/**
* Team Shortcode
* @param [type] $atts
* @param string $content
* @return [type]
*/
add_shortcode( 'dc_team', function( $atts, $content = null ){
ob_start();
$args = array(
'posts_per_page' => -1,
'post_type' => 'dc_team'
);
$data = get_posts( $args );
if(count($data)>0){ ?>
<div class="row">
<?php foreach ($data as $key => $value) { ?>
<div class="col-md-3 col-sm-4 col-xs-6">
<div class="center team-member">
<p><img class="img-circle img-thumbnail" src="<?php echo dc_get_thumb_url($value->ID) ?>" alt="?php echo $value->post_title; ?>"></p>
<h4>
<?php echo $value->post_title; ?>
<?php if(get_post_meta($value->ID, 'team_designation', true)!=''){ ?>
<br><small class="designation muted"><?php echo get_post_meta($value->ID, 'team_designation', true) ?></small>
<?php } ?>
</h4>
<p><?php echo $value->post_content; ?></p>
<div class="social-btns clearfix">
<?php if(get_post_meta($value->ID, 'team_facebook', true)!=''){ ?>
<a class="btn btn-social btn-facebook" href="<?php echo get_post_meta($value->ID, 'team_facebook', true) ?>"><i class="icon-facebook"></i></a>
<?php } ?>
<?php if(get_post_meta($value->ID, 'team_twitter', true)!=''){ ?>
<a class="btn btn-social btn-twitter" href="<?php echo get_post_meta($value->ID, 'team_twitter', true)?>"><i class="icon-twitter"></i></a>
<?php } ?>
<?php if(get_post_meta($value->ID, 'team_gplus', true)!=''){ ?>
<a class="btn btn-social btn-google-plus" href="<?php echo get_post_meta($value->ID, 'team_gplus', true)?>"><i class="icon-google-plus"></i></a>
<?php } ?>
<?php if(get_post_meta($value->ID, 'team_linkedin', true)!=''){ ?>
<a class="btn btn-social btn-linkedin" href="<?php echo get_post_meta($value->ID, 'team_linkedin', true)?>"><i class="icon-linkedin"></i></a>
<?php } ?>
<?php if(get_post_meta($value->ID, 'team_pinterest', true)!=''){ ?>
<a class="btn btn-social btn-pinterest" href="<?php echo get_post_meta($value->ID, 'team_pinterest', true)?>"><i class="icon-pinterest"></i></a>
<?php } ?>
</div>
</div>
</div><!--/.col-->
<?php } ?>
</div><!--/.team-->
<?php } else { ?>
<div class="alert alert-danger fade in">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<?php _e('No Team found!', peepalcomsys); ?>
</div>
<?php
}
return ob_get_clean();
});
/**
* Accordion Shortcode
* @param [type] $atts
* @param string $content
* @return [type]
*/
add_shortcode( 'dc_accordion', function( $atts, $content = null ){
ob_start();
$atts = shortcode_atts(
array(
'category' => 0
), $atts);
extract($atts);
$args = array(
'post_type'=>'dc_accordion',
'orderby' => 'menu_order',
'order' => 'ASC'
);
if( $category > 0 ){
$args['tax_query'] = array(
array(
'posts_per_page' => -1,
'taxonomy' => 'cat_accordions',
'field' => 'term_id',
'terms' => $category
)
);
}
$id = $category;
$accordions = get_posts( $args );
if(count($accordions)>0){ ?>
<div class="panel-group" id="panel-<?php echo $id; ?>">
<?php foreach ($accordions as $key => $value) { ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<a class="accordion-toggle <?php echo ($key==0)? '':'collapsed'; ?>" data-toggle="collapse" data-parent="#panel-<?php echo $id ?>" href="#accordion-<?php echo $value->ID . $category; ?>">
<?php echo do_shortcode( $value->post_title ); ?>
</a>
</h3>
</div>
<div id="accordion-<?php echo $value->ID . $category; ?>" class="panel-collapse <?php echo ($key==0)? 'collapse in':'collapse'; ?>">
<div class="panel-body">
<?php echo do_shortcode( $value->post_content ); ?>
</div>
</div>
</div>
<?php } ?>
</div>
<?php } else { ?>
<div class="alert alert-danger fade in">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<?php _e('No accordion item found!', peepalcomsys); ?>
</div>
<?php
}
return ob_get_clean();
});
//columns
add_shortcode( 'dc_columns', function( $atts=array(), $content=null ){
$output = '<div class="row">';
$output .= do_shortcode( str_replace('<p></p>', '', $content) );
$output .= '</div>';
return $output;
});
//column
add_shortcode( 'dc_column', function( $atts, $content=null ){
$atts = shortcode_atts(
array(
'size' => '1'
), $atts);
$output = '<div class="col-md-'.$atts['size'].'">';
$output .= do_shortcode( str_replace('<p></p>', '', $content) );
$output .= '</div>';
return $output;
});
//Tab
add_shortcode( 'dc_tab', function( $atts, $content = null ){
ob_start();
$atts = shortcode_atts(
array(
'category' => '0'
), $atts);
extract($atts);
$args = array(
'post_type'=>'dc_tab',
'orderby' => 'menu_order',
'order' => 'ASC'
);
if( $category > 0 ){
$args['tax_query'] = array(
array(
'posts_per_page' => -1,
'taxonomy' => 'cat_tabs',
'field' => 'term_id',
'terms' => $category
)
);
}
$tabs = get_posts( $args );
if(count($tabs)>0) {
?>
<ul class="nav nav-tabs">
<?php foreach ($tabs as $key => $value) { ?>
<li class="<?php echo ($key==0)?'active':''; ?>" ><a href="#tab-<?php echo $value->ID . $category; ?>" data-toggle="tab"><?php echo do_shortcode( $value->post_title ); ?></a></li>
<?php } ?>
</ul>
<div class="tab-content">
<?php foreach ($tabs as $key => $value) { ?>
<div class="tab-pane fade<?php echo ($key==0)?' active in':''; ?>" id="tab-<?php echo $value->ID . $category; ?>"><?php echo do_shortcode( $value->post_content ); ?></div>
<?php } ?>
</div>
<?php
} else {
?>
<div class="alert alert-danger fade in">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<?php _e( 'No Tab Item found!', peepalcomsys ); ?>
</div>
<?php
}
wp_reset_postdata();
return ob_get_clean();
});
//Pricing
add_shortcode( 'dc_pricing', function( $atts, $content = null ){
ob_start();
$atts = shortcode_atts(
array(
'category' => '0'
), $atts);
extract($atts);
$args = array(
'post_type'=>'dc_pricing',
'orderby' => 'menu_order',
'order' => 'ASC'
);
if( $category > 0 ){
$args['tax_query'] = array(
array(
'posts_per_page' => -1,
'taxonomy' => 'cat_pricing',
'field' => 'term_id',
'terms' => $category
)
);
}
$pricings = get_posts( $args );
if(count($pricings)>0) {
?>
<div class="row pricing-tables">
<?php foreach ($pricings as $key => $value) { ?>
<?php $featured = get_post_meta($value->ID, 'pricing_featured',true); ?>
<div class="col-lg-<?php echo round(12/count($pricings)); ?>">
<ul class="plan<?php echo ($featured==1)? ' featured' : ''; ?>">
<li class="plan-name">
<h3><?php echo $value->post_title; ?></h3>
</li>
<li class="plan-price">
<div>
<span class="price"><?php echo get_post_meta($value->ID, 'pricing_price',true) ?></span>
<small><?php echo get_post_meta($value->ID, 'pricing_duration',true) ?></small>
</div>
</li>
<li class="plan-details"><?php echo $value->post_content; ?></li>
<li class="plan-button-box">
<a class="btn btn-primary" href="<?php echo get_post_meta($value->ID, 'pricing_button_url',true) ?>"><?php echo get_post_meta($value->ID, 'pricing_button_text',true) ?></a>
</li>
</ul>
</div>
<?php } ?>
</div>
<?php
} else {
?>
<div class="alert alert-danger fade in">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<?php _e( 'No pricing table found!', peepalcomsys ); ?>
</div>
<?php
}
wp_reset_postdata();
return ob_get_clean();
});
//Icon
add_shortcode( 'dc_icon', function( $atts, $content=null ){
$atts = shortcode_atts(array(
'image' => 'icon-home',
'size' => ''
), $atts);
extract($atts);
$icon = $image . ' ' . $size;
return '<i class="' . $icon . '"></i>';
});
//Dropcap
add_shortcode( 'dc_dropcap', function( $atts, $content="" ) {
return '<p class="dropcap">' . do_shortcode( $content ) .'</p>';
} );
//Block Numbers
add_shortcode( 'dc_blocknumber', function( $atts, $content="" ) {
extract(shortcode_atts(array(
'number' => '01',
'background' => '#333',
'color' => '#999',
'borderradius'=>'2px'
), $atts));
return '<p class="blocknumber"><span style="background:'.$background.';color:'.$color.';border-radius:'.$borderradius.'">' . $number . '</span> ' . do_shortcode( $content ) . '</p>';
} );
//Block
add_shortcode( 'dc_block', function( $atts, $content="" ) {
extract(shortcode_atts(array(
'background' => 'transparent',
'color' => '#666',
'borderradius'=>'2px',
'padding' => '15px'
), $atts));
return '<div class="block" style="background:'.$background.';color:'.$color.';border-radius:'.$borderradius.';padding:'.$padding.'">'.$content.'</div>';
} );
//Recent Works
add_shortcode( 'dc_recent_works', function( $atts, $content= null ){
ob_start();
$atts = shortcode_atts(array(
'slides' => 2,
'title' => '',
'description' => ''
), $atts);
extract($atts);
$item_per_slide = 3;
$args = array(
'numberposts' => $item_per_slide*$slides,
'orderby' => 'menu_order',
'order' => 'ASC',
'post_type' => 'dc_portfolio'
);
$portfolios = get_posts( $args );
$i = 1;
$j = 1;
$count = count($portfolios);
if ($count>0) {
?>
<div class="col-md-3">
<h3><?php echo $title; ?></h3>
<p><?php echo $description; ?></p>
<div class="btn-group">
<a class="btn btn-danger" href="#scroller" data-slide="prev"><i class="icon-angle-left"></i></a>
<a class="btn btn-danger" href="#scroller" data-slide="next"><i class="icon-angle-right"></i></a>
</div>
</div>
<div class="col-md-9">
<div id="scroller" class="carousel slide">
<div class="carousel-inner">
<?php
foreach( $portfolios as $key=>$value ) {
if( (($key+1)%($item_per_slide)==0) || $j== $count) {
$lastContainer= true;
} else {
$lastContainer= false;
}
if($i==1){
?>
<div class="item <?php echo ($key==0)? 'active': ''; ?>">
<div class="row">
<?php
}
?>
<div class="col-xs-<?php echo round(12/$item_per_slide) ?>">
<div class="portfolio-item">
<div class="item-inner">
<?php
echo get_the_post_thumbnail( $value->ID, array(400,400), array(
'class' => "img-responsive",
'alt' => trim(strip_tags( $value->post_title )),
'title' => trim(strip_tags( $value->post_title ))
));
?>
<h5>
<?php echo $value->post_title; ?>
</h5>
<div class="overlay">
<?php
$full_img = wp_get_attachment_image_src( get_post_thumbnail_id($value->ID), 'full');
$img_src= $full_img[0];
?>
<a class="preview btn btn-danger" title="<?php echo $value->post_title; ?>" href="<?php echo $img_src; ?>" rel="prettyPhoto"><i class="icon-eye-open"></i></a>
</div>
</div><!--.item-inner-->
</div><!--.portfolio-item-->
</div>
<?php
if(($i == $item_per_slide) || $lastContainer) {
?>
</div><!--/.row-->
</div><!--/.col-xs-->
<?php
$i=0;
}
$i++;
$j++;
}
?>
</div>
</div>
</div><!--/.col-md-9-->
<?php
}
return ob_get_clean();
});
//fontawesome font list
add_shortcode( 'dc_fontawesome', function( $atts, $content = null ) {
global $fontawesome_icons;
$output = '<h1>Total ' . count($fontawesome_icons) . ' Awesome Icons</h1><div class="divider-sm"></div>';
$output .= '<div class="row">';
foreach ($fontawesome_icons as $key => $value) {
$output .='<div class="col-sm-3 col-sx-6"><p><i style="display: inline-block; margin-right: 10px;" class="' . $value . '"></i> ' . $value . '</p></div>';
}
$output .='</div>';
return $output;
});

View File

@@ -0,0 +1,180 @@
<?php
/**
* Simple Widget lets you to choose the post type.
* Author: Raju Shrestha <amritms@gmail.com>
*
*/
// Creating the simple_post widget
class simple_post_widget extends WP_Widget
{
function __construct()
{
parent::__construct(
// Base ID of your widget
'simple_post_widget',
// Widget name will appear in UI
__('Simple Post Widget', 'simple_post_widget_domain'),
// Widget description
array('description' => __('Simple Post widget ', 'simple_post_widget_domain'),)
);
}
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
* Creating widget front-end
* This is where the action happens
* */
public function widget($args, $instance)
{
$title = apply_filters('widget_title', $instance['title']);
$numberOfListings = apply_filters('widget_numberOfListings', $instance['numberOfListings']);
$post_type = esc_attr($instance['post_type']);
$show_date = esc_attr($instance['show_date']);
$show_description = esc_attr($instance['show_description']);
$show_thumb = esc_attr($instance['show_thumb']);
$col = $show_thumb == 'on' ? 9 : 12;
// $maxlines = esc_attr($instance['maxlines']);
// before and after widget arguments are defined by themes
echo $args['before_widget'];
if (!empty($title))
echo $args['before_title'] . $title . $args['after_title'];
if (empty($orderby)) $pfunc = 'post_date desc';
$gp_args = array(
'posts_per_page' => $numberOfListings,
'post_type' => $post_type,
'orderby' => 'post_date',
'order' => 'desc',
'post_status' => 'publish',
);
// $loop = new WP_Query( $gp_args );
$posts = get_posts($gp_args);
//var_dump($posts);
foreach ($posts as $post):
echo '<div class=" recent-news">';
if($show_thumb){
if(has_post_thumbnail($post->ID)){
$col = 8;
echo '<div class="col-md-4">' . get_the_post_thumbnail($post->ID, 'thumbnail', array('class' => 'img-responsive')) . '</div>';
}else{
$col = 12;
}
}
echo "<a class='col-md-{$col} col-sm-{$col} col-xs-{$col}'";
echo 'href="' . get_permalink($post->ID) . '" title="Read the story, ' . $post->post_title . '">';
echo $post->post_title;
if($show_date == 'on') echo '<div style="font-size:10px">' . date('Y-m-d', strtotime($post->post_date)) . '</div>';
if($show_description == 'on') {
if (strlen($post->post_content) > 50) {
echo substr($post->post_content, 0, 47) . '...';
}
else substr($post->post_content, 0, 50);
}
echo '</a>';
echo '</div>';
endforeach;
}
// Widget Backend
public function form($instance)
{
if (isset($instance['title'])) {
$title = $instance['title'];
} else {
$title = __('New title', 'simple_post_widget_domain');
}
if (isset($instance['numberOfListings'])) {
$numberOfListings = $instance['numberOfListings'];
} else {
$numberOfListings = __('5', 'simple_post_widget_domain');
}
$post_type = isset($instance['post_type']) ? esc_attr($instance['post_type']) : '';
$show_date = isset($instance['show_date']) ? esc_attr($instance['show_date']) : 'on';
$show_description = isset($instance['show_description']) ? esc_attr($instance['show_description']) : '';
$show_thumb = isset($instance['show_thumb']) ? esc_attr($instance['show_thumb']) : '';
// Widget admin form
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
name="<?php echo $this->get_field_name('title'); ?>" type="text"
value="<?php echo esc_attr($title); ?>"/>
</p>
<p>
<label for="<?php echo $this->get_field_id('post_type');?>"><?php _e('Post Type');?></label>
<select id="<?php echo $this->get_field_id('post_type'); ?>"
name="<?php echo $this->get_field_name('post_type'); ?>">
<?php
$post_types = get_post_types('', 'names');
$badtypes = array('nav_menu_item', 'revision', 'attachment', 'page'); // others????
foreach ($post_types as $ptype) {
if (!in_array($ptype, $badtypes)) {
echo "<option value=\"$ptype\" ";
if ($post_type == $ptype) echo 'selected="true"';
echo ">$ptype</option>";
}
}
?>
</select>
</p>
<p>
<label for="<?php echo $this->get_field_id('numberOfListings'); ?>"><?php _e('No. Of Posts:'); ?></label>
<select id="<?php echo $this->get_field_id('numberOfListings'); ?>"
name="<?php echo $this->get_field_name('numberOfListings'); ?>">
<?php for ($x = 1; $x <= 10; $x++): ?>
<option <?php echo $x == $numberOfListings ? 'selected="selected"' : ''; ?>
value="<?php echo $x; ?>"><?php echo $x; ?></option>
<?php endfor; ?>
</select>
</p>
<p>
<label for="<?php echo $this->get_field_id('show_date');?>"><?php _e("Show Date:");?></label>
<input type="checkbox" id="<?php echo $this->get_field_id('show_date');?>" name="<?php echo $this->get_field_name('show_date') ?>" <?php if($show_date == 'on') echo 'checked';?>/>
</p>
<p>
<label for="<?php echo $this->get_field_id('show_description');?>"><?php _e("Show Description:");?></label>
<input type="checkbox" id="<?php echo $this->get_field_id('show_description');?>" name="<?php echo $this->get_field_name('show_description') ?>" <?php if($show_description == 'on') echo 'checked';?>/>
</p>
<p>
<label for="<?php echo $this->get_field_id('show_thumb');?>"><?php _e("Show Thumbnail:");?></label>
<input type="checkbox" id="<?php echo $this->get_field_id('show_thumb');?>" name="<?php echo $this->get_field_name('show_thumb') ?>" <?php if($show_thumb == 'on') echo 'checked';?>/>
</p>
<?php
}
// Updating widget replacing old instances with new
public function update($new_instance, $old_instance)
{
$instance = array();
$instance['title'] = (!empty($new_instance['title'])) ? strip_tags($new_instance['title']) : '';
$instance['numberOfListings'] = (!empty($new_instance['numberOfListings'])) ? strip_tags($new_instance['numberOfListings']) : '5';
$instance['post_type'] = esc_attr($new_instance['post_type']);
$instance['show_date'] = esc_attr($new_instance['show_date']);
$instance['show_description'] = esc_attr($new_instance['show_description']);
$instance['show_thumb'] = esc_attr($new_instance['show_thumb']);
return $instance;
}
} // Class wpb_widget ends here
// Register and load the widget
function simple_post_load_widget()
{
register_widget('simple_post_widget');
}
add_action('widgets_init', 'simple_post_load_widget');
// end of simple_post widget

View File

@@ -0,0 +1,330 @@
<?php
/*
* Theme Option Functions
*/
//Favicon Image
if (!function_exists("dc_favicon")) {
function dc_favicon(){
if(dc_option('dc_favicon') == ""){
echo '<link rel="shortcut icon" href="' . get_template_directory_uri() . '/favicon.png" >';
} else {
echo '<link rel="shortcut icon" href="' . dc_option('dc_favicon') .'" >';
}
if (dc_option('dc_show_apple_logo')) {
echo dc_option('dc_apple_iphone_icon') != "" ? ('<link rel="apple-touch-icon" href="' . dc_option('dc_apple_iphone_icon') . '"/>') : '';
echo dc_option('dc_apple_iphone_retina_icon') != "" ? ('<link rel="apple-touch-icon" sizes="114x114" href="' . dc_option('dc_apple_iphone_retina_icon') . '"/>') : '';
echo dc_option('dc_apple_ipad_icon') != "" ? ('<link rel="apple-touch-icon" sizes="72x72" href="' . dc_option('dc_apple_ipad_icon') . '"/>') : '';
echo dc_option('dc_apple_ipad_retina_icon') != "" ? ('<link rel="apple-touch-icon" sizes="144x144" href="' . dc_option('dc_apple_ipad_retina_icon') . '"/>') : '';
}
}
}
//Comments On Pages
if (!function_exists("comments_page")) {
function comments_page(){
if(dc_option('dc_blog_comments') && is_page()){
comments_template();
}
}
}
//Logo Option
if (!function_exists("logo")) {
function logo(){
if( dc_option( 'dc_show_logo' ) == 0 ){ ?>
<a class="navbar-brand" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"><i class="icon-cloud"></i> <?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?></a>
<?php } else{ ?>
<a class="navbar-brand" href="<?php echo esc_url( home_url( '/' ) ); ?>" >
<img src="<?php echo dc_option( 'site_logo' );?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" />
</a>
<?php
}
}
}
//Copyright Text
if( !function_exists('show_footer')){
function show_footer(){
if(dc_option( 'dc_footer_text_info' ) == 1){
echo dc_option( 'dc_copyright_text' );
}
}
}
//Google Analytics
if( !function_exists('google_analytics') ){
function google_analytics(){
echo dc_option('dc_google_analytics');
}
}
//Blog Sidebar Position
if(!function_exists('blog_date')){
function blog_date(){
if(dc_option('dc_blog_date')){
echo dc_option('dc_blog_date');
//the_time('$time');
}
}
}
//Featured Image on Single Post
if( !function_exists('featured_image_single_post')){
function featured_image_single_post(){
if(dc_option( 'dc_single_featured_image' ) == 1){
the_post_thumbnail();
}
}
}
//Post Author Section
if( !function_exists('dc_author_bio')){
function dc_author_bio(){
if( dc_option('dc_single_post_author') ){
echo dc_option('dc_single_post_author');
}
}
}
//Comments On Blog
if (!function_exists("blog_comments")) {
function blog_comments(){
if(dc_option('dc_blog_comments') == 1 && is_single()){
comments_template();
}
}
}
//Excerp Length
function dc_excerpt_length($length) {
return dc_option('dc_excerpt_len');
}
add_filter('excerpt_length', 'dc_excerpt_length');
//Styling Options
function dc_style_options(){
ob_start();
if( dc_option('dc_body_text_font','face') ){
echo '@import url(http://fonts.googleapis.com/css?family='. str_replace(' ','+',dc_option('dc_body_text_font','face')) .':400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic);';
} else {
echo '@import url(http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic);
';
}
if( dc_option('dc_heading_font','face') and ( dc_option('dc_body_text_font','face')!=dc_option('dc_heading_font','face') ) ){
echo "\n" . '@import url(http://fonts.googleapis.com/css?family='.str_replace(' ','+',dc_option('dc_heading_font','face')).':400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic);';
}
?>
/* Body Style */
body{
<?php
if( dc_option('dc_body_background') ){
echo 'background: ' . dc_option('dc_body_background') . ';';
}
if( dc_option('dc_body_text_font','color') ){
echo 'color: ' . dc_option('dc_body_text_font','color') . ';';
}
if( dc_option('dc_body_text_font','face') ){
echo 'font-family: \'' . dc_option('dc_body_text_font','face') . '\';';
} else {
echo 'font-family: \'Roboto\', sans-serif;';
}
if( dc_option('dc_body_text_font','size') ){
echo 'size: ' . dc_option('dc_body_text_font','size') . ';';
}
?>
}
/* Heading Style */
h1, h2, h3, h4, h5, h6{
<?php
if( dc_option('dc_heading_font','face') ){
echo 'font-family: \'' . dc_option('dc_heading_font','face') . '\';';
} else {
echo 'font-family: \'Roboto\', sans-serif;';
}
?>
}
/*Link Color*/
a {
<?php
if( dc_option('dc_link_color') ){
echo 'color: ' . dc_option('dc_link_color') . ';';
}
?>
}
/*Link Hover Color*/
a:hover {
<?php
if( dc_option('dc_link_color') ){
echo 'color: ' . dc_option('dc_link_hover_color') . ';';
}
?>
}
/* Header Style */
#header {
<?php
if( dc_option('dc_header_background') ){
echo 'background-color: ' . dc_option('dc_header_background') . ';';
}
?>
}
/* Custom CSS */
<?php echo dc_option('dc_custom_css');?>
<?php
return ob_get_clean();
}
//Social Sharing
function dc_social_share(){
global $dc_socials;
foreach ($dc_socials as $key => $value) {
# code...
if(dc_option($value['name']) !=""){
echo '<a href="' . str_replace('*', dc_option($value['name']), $value['link']) . '" target="_blank" title="' . $key . '" class="' . $key . '"><span class="icon-'. $key . '"></span></a>';
}
}
}
global $dc_socials;
$dc_socials = array(
'facebook' => array(
'name' => 'dc_facebook_username',
'link' => 'http://www.facebook.com/*',
),
'google-plus' => array(
'name' => 'dc_googleplus_username',
'link' => 'https://plus.google.com/u/0/*'
),
'twitter' => array(
'name' => 'dc_twitter_username',
'link' => 'http://twitter.com/*',
),
'youtube-play' => array(
'name' => 'dc_youtube_username',
'link' => 'http://www.youtube.com/user/*',
)
);
//Show Admin Bar
if(!function_exists('dc_adminbar')){
function dc_adminbar(){
if(dc_option('dc_admin_bar')==1){
if(current_user_can( 'manage_options' ))
return true;
else
return false;
}
add_filter('show_admin_bar','dc_adminbar');
}
}
if(!function_exists('dc_admin_logo')){
function dc_admin_logo(){
if(dc_option('dc_logo_login')){
?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo dc_option('dc_logo_login');?>);
padding-bottom: 30px;
}
</style>
<?php } else { ?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo admin_url('/images/wordpress-logo.png');?>);
padding-bottom: 30px;
}
</style>
<?php }
}
add_action( 'login_enqueue_scripts', 'dc_admin_logo' );
}
if(!function_exists('dc_logo_login_url')){
function dc_logo_login_url(){
return site_url();
}
add_filter( 'login_headerurl', 'dc_logo_login_url' );
}
//
function dc_exclude_search_pages($query) {
if(dc_option('dc_exclude_search_page')==1){
if ( $query->is_search ) {
$query->set('post_type', 'post');
}
return $query;
}
}
add_filter('pre_get_posts','dc_exclude_search_pages');
//}
function get_video_ID($link){
if( empty($link) ) return false;
$path = trim(parse_url($link, PHP_URL_PATH), '/');
$query_string = parse_url($link, PHP_URL_QUERY);
parse_str($query_string, $output);
if( empty($output) ){
return $path;
} else {
return $output['v'];
}
}

View File

@@ -0,0 +1,187 @@
<?php
//register widgetS
function register_dc_widget() {
register_widget( 'dc_Recent_Posts_Widget' );
}
add_action( 'widgets_init', 'register_dc_widget' );
/**
* Add dc_Recent_Posts_Widget widget.
*/
class dc_Recent_Posts_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'dc_recent_posts', // Base ID
'dc Recent Posts', // Name
array( 'description' => __( 'Recent Posts Widget', 'peepalcomsys' ), ) // Args
);
}
public function widget( $args, $instance ) {
$title = $instance['title'];
$count = $instance['count'];
echo $args['before_widget'];
echo $args['before_title'] . $title . $args['after_title'];
$posts = get_posts( array( 'numberposts' => $count ) );
foreach ($posts as $key => $value) {
?>
<div class="media">
<div class="pull-left">
<?php echo get_the_post_thumbnail( $value->ID, array(64,64) ); ?>
</div>
<div class="media-body">
<span class="media-heading"><a href="<?php echo get_permalink( $value->ID ); ?>"><?php echo $value->post_title; ?></a></span>
<small class="muted"><?php _e('Posted', 'peepalcomsys'); ?> <?php echo date( 'd F Y', strtotime($value->post_date) ); ?></small>
</div>
</div>
<?php }
echo $args['after_widget'];
}
public function form( $instance ) {
$title = isset($instance[ 'title' ]) ? $instance[ 'title' ] : 'Recent Posts';
$count = isset($instance[ 'count' ]) ? $instance[ 'count' ] : 3;
?>
<p>
<label for="<?php echo $this->get_field_name( 'title' ); ?>"><?php _e( 'Title:', 'peepalcomsys' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_name( 'count' ); ?>"><?php _e( 'Number of posts:', 'peepalcomsys' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" type="text" value="<?php echo esc_attr( $count ); ?>" />
</p>
<?php
}
public function update( $new_instance, $old_instance ) {
$instance = array();
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
$instance['count'] = ( ! empty( $new_instance['count'] ) ) ? strip_tags( $new_instance['count'] ) : '';
return $instance;
}
}
/**
* Add dc Ads Widget widget.
*/
function dc_AD_Scripts(){
wp_enqueue_media();
wp_enqueue_script('adsScript', get_template_directory_uri() . '/assets/js/upload.js');
}
add_action('admin_enqueue_scripts', 'dc_AD_Scripts');
function dc_AD_Widget() {
register_widget( 'dc_AD_Widget' );
}
add_action( 'widgets_init', 'dc_AD_Widget' );
class dc_AD_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'dc_ad', // Advertisement
'Advertisement',
array( 'description' => __( 'Display Advertise image with link.', 'peepalcomsys' ), ) // Args
);
}
public function widget( $args, $instance ) {
$url = $instance['url'];
$url2 = $instance['url2'];
$img_src = $instance['img_src'];
$img_src2 = $instance['img_src2'];
echo $args['before_widget'];
//echo $args['before_title'] . $title . $args['after_title'];
?>
<div class="widget ads">
<div class="row">
<div class="col-xs-6">
<?php $urls = esc_url($instance['url']);
$images = esc_url($instance['img_src']);
if( $urls || $images) {
?>
<a class="img-responsive img-rounded" href="<?php echo $urls; ?>" target="_blank"><img class="img-responsive img-rounded" src="<?php echo $images; ?>" class="img-thumbnail"/></a>
<?php } else{
?>
<a class="img-responsive img-rounded" href="#" target="_blank"><img class="img-responsive img-rounded" src="<?php echo get_template_directory_uri(); ?>/assets/images/ad2.jpg" class="img-thumbnail"/></a>
<?php } ?>
</div>
<div class="col-xs-6">
<?php $urls2 = esc_url($instance['url2']);
$images2 = esc_url($instance['img_src2']);
if( $urls2 || $images2) {
?>
<a href="<?php echo esc_url($instance['url2']); ?>" target="_blank"><img class="img-responsive img-rounded" src="<?php echo esc_url($instance['img_src2']); ?>" class="img-thumbnail"/></a>
<?php } else{
?>
<a class="img-responsive img-rounded" href="#" target="_blank"><img class="img-responsive img-rounded" src="<?php echo get_template_directory_uri(); ?>/assets/images/ad2.jpg" class="img-thumbnail"/></a>
<?php } ?>
</div>
</div>
</div>
<?php
echo $args['after_widget'];
}
public function form( $instance ) {
/* $img_id = $this->get_field_id('img_src');
$img_id2 = $this->get_field_id('img_src2');
$url = $instance['url'];
$url2 = $instance['url2'];
$img_src = $instance['img_src'];
$img_src2 = $instance['img_src2'];
*/
?>
<div class="widget-content">
<p>
<label for="<?php echo $this->get_field_id('url'); ?>">URL:</label><br/>
<input class="widefat" type="text" id="<?php echo $this->get_field_id('url'); ?>" name="<?php echo $this->get_field_name('url'); ?>" value="<?php if(!empty($instance['url'])){echo $instance['url'];} ?>" />
</p>
<label for="<?php echo $this->get_field_id('img_src'); ?>">Image</label><br />
<?php if(!empty($instance['img_src'])){ ?>
<img class="custom_media_image" src="<?php echo $instance['img_src'];?>" style="margin:0;padding:0;max-width:100px;float:left;display:inline-block" />
<?php } ?>
<input type="text" class="widefat custom_media_url" name="<?php echo $this->get_field_name('img_src'); ?>" id="<?php echo $this->get_field_id('img_src'); ?>" value="<?php if(!empty($instance['img_src'])){echo $instance['img_src'];} ?>">
<a href="#" class="button custom_media_upload"><?php _e('Upload', peepalcomsys); ?></a>
<p>
<label for="<?php echo $this->get_field_id('url2');?>">URL:</label><br/>
<input class="widefat" type="text" id="<?php echo $this->get_field_id('url2'); ?>" name="<?php echo $this->get_field_name('url2'); ?>" value="<?php if(!empty($instance['url2'])){echo $instance['url2'];} ?>" />
</p>
<label for="<?php echo $this->get_field_id('img_src2'); ?>">Image</label><br />
<?php if(!empty($instance['img_src2'])){ ?>
<img class="custom_media_image2" src="<?php if(!empty($instance['img_src2'])){echo $instance['img_src2'];} else{ echo "No Image";}?>" style="margin:0;padding:0;max-width:100px;float:left;display:inline-block" />
<?php } ?>
<input type="text" class="widefat custom_media_url2" name="<?php echo $this->get_field_name('img_src2'); ?>" id="<?php echo $this->get_field_id('img_src2'); ?>" value="<?php if(!empty($instance['img_src2'])){echo $instance['img_src2'];} ?>">
<a href="#" class="button custom_media_upload2"><?php _e('Upload', peepalcomsys); ?></a>
</div>
<?php
}
public function update( $new_instance, $old_instance ) {
$instance = array();
$instance['url'] = ( ! empty( $new_instance['url'] ) ) ? strip_tags( $new_instance['url'] ) : '';
$instance['url2'] = ( ! empty( $new_instance['url2'] ) ) ? strip_tags( $new_instance['url2'] ) : '';
$instance['img_src'] = ( ! empty( $new_instance['img_src'] ) ) ? strip_tags( $new_instance['img_src'] ) : '';
$instance['img_src2'] = ( ! empty( $new_instance['img_src2'] ) ) ? strip_tags( $new_instance['img_src2'] ) : '';
$instance['image_uri'] = strip_tags( $new_instance['image_uri'] );
return $instance;
}
}