Esempio n. 1
0
 /**
  * AJAX callback for rendering icons popup.
  *
  * Outputs HTML
  *
  * @since 1.0.0
  */
 public function icons_callback()
 {
     if (empty($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'appica-ajax')) {
         die;
     }
     // Current icon, for repeated opening popup
     $current = sanitize_text_field($_POST['current']);
     $icons = Appica_Helpers::get_icons();
     $html = '';
     if (0 !== count($icons)) {
         $_el = array();
         /**
          * @var string Template for single filterable icon
          */
         $tpl = '<li data-filtertext="%1$s" %2$s><a href="#" class="appica-core-icon" data-icon="%1$s"><i class="%1$s"></i></a></li>';
         $html .= '<form class="ui-filterable"><input type="text" id="appica-core-icons-filterable-input" class="widefat" data-type="search"></form>';
         $html .= '<ul class="appica-core-filterable-icons clearfix" data-role="listview" data-filter="true" data-input="#appica-core-icons-filterable-input">';
         foreach ((array) $icons as $icon) {
             $active = $icon === $current ? 'class="active"' : '';
             $_el[] = sprintf($tpl, $icon, $active);
         }
         $html .= implode('', $_el);
         $html .= '</ul>';
     } else {
         $html .= '<p>' . __('No icons found', 'appica') . '</p>';
     }
     print $html;
     die;
 }
Esempio n. 2
0
<?php

/**
 * Shortcode "Appica Custom Title" output
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
$a = shortcode_atts(array('title' => '', 'subtitle' => '', 'align' => 'left', 'extra_class' => ''), $atts);
/*
 * Prepare attributes
 */
$title = esc_html($a['title']);
$subtitle = esc_attr($a['subtitle']);
$align = $a['align'];
$classes = Appica_Helpers::get_class_set(array('block-heading', "text-{$align}", $a['extra_class']));
// 1 - title, 2 - subtitle, 3 - class set
printf('<div class="%3$s"><h2>%1$s</h2><span>%2$s</span></div>', $title, $subtitle, $classes);
Esempio n. 3
0
/**
 * Enqueue scripts and styles on admin screens
 *
 * @since 1.0.0
 */
function appica_core_scripts()
{
    wp_register_style('appica-fancybox2', plugins_url('assets/css/fancybox/jquery.fancybox.css', __FILE__), array(), null);
    wp_register_style('appica-filterable', plugins_url('assets/css/jquery.mobile.custom.structure.min.css', __FILE__), array(), null);
    wp_enqueue_style('appica-core', plugins_url('assets/css/appica-core.css', __FILE__), array('appica-fancybox2', 'appica-filterable'), null);
    wp_register_script('appica-filterable', plugins_url('assets/js/jquery.mobile.custom.min.js', __FILE__), array('jquery'), null, true);
    wp_register_script('appica-fancybox2', plugins_url('assets/js/jquery.fancybox.pack.js', __FILE__), array('jquery'), null, true);
    wp_enqueue_script('appica-core', plugins_url('assets/js/appica-core-admin.js', __FILE__), array('jquery', 'appica-filterable', 'appica-fancybox2'), null, true);
    wp_enqueue_media();
    wp_localize_script('appica-core', 'appicaCore', array('nonce' => wp_create_nonce('appica-ajax'), 'icon' => array('preview' => '', 'value' => '')));
    $head_css = Appica_Helpers::get_head_css();
    wp_add_inline_style('appica-core', $head_css);
}
Esempio n. 4
0
<?php

/**
 * Shortcode "Fancy text" output
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
$a = shortcode_atts(array('extra_class' => '', 'first_title' => '', 'first_subtitle' => '', 'first_percent' => '', 'first_color' => '', 'second_title' => '', 'second_subtitle' => '', 'second_percent' => '', 'second_color' => '', 'third_title' => '', 'third_subtitle' => '', 'third_percent' => '', 'third_color' => ''), $atts);
$charts = array(array('title' => esc_html($a['first_title']), 'subtitle' => esc_html($a['first_subtitle']), 'percent' => (int) trim($a['first_percent'], '.,%'), 'color' => $a['first_color']), array('title' => esc_html($a['second_title']), 'subtitle' => esc_html($a['second_subtitle']), 'percent' => (int) trim($a['second_percent'], '.,%'), 'color' => $a['second_color']), array('title' => esc_html($a['third_title']), 'subtitle' => esc_html($a['third_subtitle']), 'percent' => (int) trim($a['third_percent'], '.,%'), 'color' => $a['third_color']));
$classes = Appica_Helpers::get_class_set(array('bar-charts', $a['extra_class']));
?>
<div class="<?php 
echo $classes;
?>
">
	<div class="grid"></div>
	<div class="row">
		<div class="col-md-10 col-md-offset-1">
			<div class="row"><?php 
foreach ($charts as $i => $chart) {
    if (0 === $chart['percent']) {
        continue;
    }
    // 1 - percent, 2 - title, 3 - subtitle, 4 - color
    printf('<div class="col-lg-%5$d col-xs-4"><div class="chart" data-percentage="%1$d"><span class="bar" %4$s></span>%2$s%3$s</div></div>', $chart['percent'], '' === $chart['title'] ? '' : "<h3>{$chart['title']}</h3>", '' === $chart['subtitle'] ? '' : "<p>{$chart['subtitle']}</p>", '' === $chart['color'] ? '' : "style=\"background-color: {$chart['color']};\"", 0 === $i ? 3 : 4);
}
?>
            foreach ((array) $plan['terms'] as $term => $price) {
                $_data[] = sprintf('data-%1$s="%2$s"', $term, $price);
            }
            unset($term, $price);
            $_data_set = implode(' ', (array) $_data);
            unset($_data);
        }
        printf('<i class="price" %2$s>%1$s</i>', $_first_price, $_data_set);
        printf('<span class="period">%s</span>', $_first_term);
        echo '</div>';
        // .pricing-plan-title
        if ('' !== $button) {
            $url = '' === $button['url'] ? '#' : esc_url($button['url']);
            $text = '' === $button['text'] ? '' : esc_html($button['text']);
            $target = '' === $button['target'] ? '' : sprintf('target="%s"', $button['target']);
            $classes = Appica_Helpers::get_class_set(array('btn', 'btn-block', 'btn-plus', 'yes' === $button['active'] ? 'btn-light' : ''));
            printf('<a href="%1$s" class="%3$s" %4$s>%2$s</a>', $url, $text, $classes, $target);
            unset($url, $text, $target, $classes);
        }
        echo '<div class="pricing-plan-description">';
        the_content();
        echo '</div></div>';
        // end .pricing-plan-description && .pricing-plan
        unset($icon, $button, $plans);
    }
    echo '</div>';
}
wp_reset_postdata();
if ('' !== $extra) {
    echo '</div>';
}
Esempio n. 6
0
<?php

/**
 * Shortcode "Fancy text" output
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
$a = shortcode_atts(array('text' => '', 'color' => 'primary', 'extra_class' => ''), $atts);
$text = esc_html($a['text']);
$classes = Appica_Helpers::get_class_set(array('text-extra-big', 'color-gradient', $a['extra_class']));
// 1 - text, 2 - classes
printf('<h3 class="%2$s">%1$s</h3>', $text, $classes);
Esempio n. 7
0
$_href = '' === $_link['url'] ? '' : esc_url($_link['url']);
$_target = '' === $_link['target'] ? '' : sprintf('target="%s"', trim($_link['target']));
$_title = '' === $_link['title'] ? '' : sprintf('title="%s"', esc_html($_link['title']));
$_text = esc_html($a['link_text']);
$link = '' === $_href || '' === $_text ? '' : sprintf('<a href="%1$s" class="link" %3$s %4$s>%2$s</a>', $_href, $_text, $_title, $_target);
unset($_link, $_href, $_target, $_title, $_text);
// Build text block
$block_text = sprintf('<div class="text text-%4$s">%1$s%2$s%3$s</div>', "<h3>{$title}</h3>", "<p>{$desc}</p>", $link, $align);
unset($text_class, $title, $desc, $link);
// Build icon
$block_icon = '';
$icon_pos = $a['icon_pos'];
$icon_size = $a['icon_size'];
$icon_va = $a['icon_va'];
$library = $a['icon_lib'];
if ('' !== $a["icon_{$library}"]) {
    // enqueue necessary css
    vc_icon_element_fonts_enqueue($library);
    $icon_wrapper_class = Appica_Helpers::get_class_set(array('icon', 'large' === $icon_size ? 'icon-bigger' : '', 'middle' === $icon_va ? 'va-middle' : ''));
    $block_icon = sprintf('<div class="%2$s"><i class="%1$s"></i></div>', $a["icon_{$library}"], $icon_wrapper_class);
    unset($icon_wrapper_class, $library);
}
// Wrapper class
$wrapper_class = Appica_Helpers::get_class_set(array('icon-block', 'left' === $icon_pos || 'right' === $icon_pos ? 'icon-block-horizontal' : '', $a['extra_class']));
/*
 * If icon position is "left" or "top", icon have to be before .text block
 * But, if icon position is "right", icon have to be after .text block
 */
// 1 - wrapper class, 2 - text block, 3 - icon block
$tpl = 'left' === $icon_pos || 'top' === $icon_pos ? '<div class="%1$s">%3$s%2$s</div>' : '<div class="%1$s">%2$s%3$s</div>';
printf($tpl, $wrapper_class, $block_text, $block_icon);
Esempio n. 8
0
 *
 * Mapped params are in {@path appica-core/inc/vc-map.php} {@see $appica_button}
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
$a = shortcode_atts(array('text' => '', 'link' => '', 'type' => 'default', 'waves' => 'dark', 'style' => 'standard', 'size' => 'nl', 'color' => 'default', 'icon_lib' => 'fontawesome', 'icon_fontawesome' => '', 'icon_openiconic' => '', 'icon_typicons' => '', 'icon_entypo' => '', 'icon_linecons' => '', 'icon_flaticons' => '', 'icon_pos' => 'left', 'is_full' => 'no', 'extra_class' => ''), $atts);
// Build link
$link = vc_build_link($a['link']);
$href = '' === $link['url'] ? '#' : esc_url($link['url']);
$target = '' === $link['target'] ? '' : sprintf('target="%s"', trim($link['target']));
$title = '' === $link['title'] ? '' : sprintf('title="%s"', esc_attr($link['title']));
// Text
$content = 'round' === $a['type'] ? '' : esc_attr($a['text']);
// Icon
$icon = '';
$icon_pos = 'right' === $a['icon_pos'] ? 'icon-right' : 'icon-left';
$library = $a['icon_lib'];
if ('' !== $a["icon_{$library}"]) {
    vc_icon_element_fonts_enqueue($library);
    $icon = sprintf('<i class="%s"></i>', $a["icon_{$library}"]);
}
// Global classes
$class = Appica_Helpers::get_class_set(array('default' === $a['type'] ? 'btn' : "btn-{$a['type']}", 'standard' === $a['style'] ? '' : 'btn-ghost', 'nl' === $a['size'] ? '' : "btn-{$a['size']}", 'default' === $a['color'] ? 'btn-default' : "btn-{$a['color']}", 'default' === $a['type'] && 'yes' === $a['is_full'] ? 'btn-block' : '', 'default' === $a['type'] && '' !== $icon ? $icon_pos : '', $a['extra_class']));
// Template with icon position
$tpl = 'right' === $a['icon_pos'] ? '<a href="%1$s" class="%4$s" %5$s %6$s>%2$s %3$s</a>' : '<a href="%1$s" class="%4$s" %5$s %6$s>%3$s %2$s</a>';
// 1 - href, 2 - content, 3 - icon, 4 - class, 5 - target, 6 - title
printf($tpl, $href, $content, $icon, $class, $target, $title);
Esempio n. 9
0
<?php

/**
 * Shortcode "News" output
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
$a = shortcode_atts(array('more' => '', 'extra_class' => ''), $atts);
$extra = Appica_Helpers::get_class_set($a['extra_class']);
$more = esc_html($a['more']);
$query = new WP_Query(array('post_type' => 'appica_news', 'post_status' => 'publish', 'posts_per_page' => -1, 'ignore_sticky_posts' => true));
// Extra class wrapper
if ('' !== $extra) {
    echo "<div class=\"{$extra}\">";
}
if ($query->have_posts()) {
    echo '<div class="row">';
    $i = 0;
    while ($query->have_posts()) {
        $query->the_post();
        if (0 === $i % 2) {
            echo '</div><div class="row">';
        }
        ?>
		<div class="col-sm-6">
			<div class="news-block">
				<span><?php 
Esempio n. 10
0
<?php

/**
 * Shortcode "Timeline" output
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
$a = shortcode_atts(array('title' => '', 'description' => '', 'extra_class' => ''), $atts);
$title = esc_html($a['title']);
$desc = strip_tags($a['description'], '<p></p>');
$classes = Appica_Helpers::get_class_set(array('timeline', 'space-top-2x', 'space-bottom-3x', $a['extra_class']));
// Print title & description
echo "<h1>{$title}</h1>", "<div class=\"text-light\"><p>{$desc}</p></div>";
// Get timeline
$query = new WP_Query(array('post_type' => 'appica_timeline', 'post_status' => 'publish', 'posts_per_page' => -1, 'ignore_sticky_posts' => true));
if ($query->have_posts()) {
    // 1 - date, 2 - title
    $tpl = '<div class="timeline-row"><div class="date">%1$s</div><div class="event"><p>%2$s</p></div></div>';
    // start .timeline
    echo "<div class=\"{$classes}\">";
    while ($query->have_posts()) {
        $query->the_post();
        $date = get_post_meta(get_the_ID(), '_appica_timeline_date', true);
        printf($tpl, $date, get_the_title());
    }
    // end .timeline
    echo '</div>';
Esempio n. 11
0
<?php

/**
 * Shortcode "Recent Posts" output
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
$a = shortcode_atts(array('per_page' => '', 'is_excerpt' => '', 'img_size' => '', 'extra_class' => ''), $atts);
$per_page = 'all' === $a['per_page'] ? -1 : absint($a['per_page']);
$is_excerpt = 'yes' === $a['is_excerpt'];
$img_size = Appica_Helpers::get_image_size($a['img_size']);
$classes = Appica_Helpers::get_class_set(array('scroller', 'posts', $a['extra_class']));
$query = new WP_Query(array('posts_per_page' => $per_page, 'post_status' => 'publish', 'ignore_sticky_posts' => true));
/*
 * Start output
 */
if ($query->have_posts()) {
    printf('<div class="%1$s">', $classes);
    /**
     * Add the temporary filter to change the excerpt length.
     * Not need in other places, so filter will be removed after WP_Query Loop.
     *
     * @since 1.0.0
     */
    add_filter('excerpt_length', array('Appica_Filters', 'excerpt_length'));
    /**
     * Temporary filter to trim the length of excerpt, if custom excerpt specified.
Esempio n. 12
0
<div class="masonry-grid filter-grid space-top-2x">
	<div class="grid-sizer"></div>
	<div class="gutter-sizer"></div>

	<?php 
    while ($query->have_posts()) {
        $query->the_post();
        if (!has_post_thumbnail()) {
            continue;
        }
        $categories = Appica_Helpers::get_post_terms(get_the_ID(), $tax);
        $figure = sprintf('<figure>%2$s<figcaption class="title-only"><h3>%1$s</h3></figcaption></figure>', get_the_title(), get_the_post_thumbnail(null, 'medium'));
        $video = get_post_meta(get_the_ID(), '_appica_gallery_video', true);
        $image = '';
        $item = '<a href="%1$s" class="gallery-item %3$s">%2$s</a>';
        printf('<div class="item %s">', Appica_Helpers::get_class_set($categories));
        if ('' !== $video) {
            printf($item, $video, $figure, 'video-item');
        } else {
            $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            printf($item, $image[0], $figure, 'image-item');
        }
        echo '</div>';
        unset($categories, $figure, $video, $image, $item);
    }
    ?>
</div><?php 
}
wp_reset_postdata();
// .end wrapper
if ('' !== $classes) {
Esempio n. 13
0
<?php

/**
 * Shortcode "Download Button" output
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
if (!function_exists('vc_build_link')) {
    return;
}
$a = shortcode_atts(array('text' => '', 'link' => '', 'extra_class' => ''), $atts);
$text = esc_html($a['text']);
$link = vc_build_link($a['link']);
$href = esc_url($link['url']);
$target = $link['target'];
$classes = Appica_Helpers::get_class_set(array('btn', 'btn-default', 'btn-app-store', $a['extra_class']));
// 1 - href, 2 - text, 3 - classes, 4 - target
printf('<a href="%1$s" class="%3$s" target="%4$s"><i class="bi-apple"></i><div><span>%2$s</span>App Store</div></a>', $href, $text, $classes, $target);
Esempio n. 14
0
						<div class="post-title">
							<a href="<?php 
        the_permalink();
        ?>
" rel="bookmark">
								<?php 
        the_title('<h3>', '</h3>');
        ?>
							</a>
							<?php 
        the_excerpt();
        ?>
						</div>

						<?php 
        Appica_Helpers::entry_footer_wo_social();
        ?>

					</div>
				</div>
			</div>

		<?php 
        unset($post_id, $is_wide);
    }
    ?>

	</div>

<?php 
}
Esempio n. 15
0
<?php

/**
 * Shortcode "Team" output
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
$a = shortcode_atts(array('extra_class' => ''), $atts);
$classes = Appica_Helpers::get_class_set($a['extra_class']);
$query = new WP_Query(array('post_type' => 'appica_team', 'post_status' => 'publish', 'posts_per_page' => -1, 'ignore_sticky_posts' => true));
if ($query->have_posts()) {
    $networks = Appica_Helpers::get_social_networks_list();
    // extra classes
    if ('' !== $classes) {
        printf('<div class="%s">', $classes);
    }
    ?>
<div class="row"><?php 
    $i = 0;
    while ($query->have_posts()) {
        $query->the_post();
        // Each 3 entries wrap to .row, but except last
        if (0 === $i % 3 && 0 !== $i % $query->post_count) {
            ?>
</div><div class="row"><?php 
        }
        $i++;
Esempio n. 16
0
/**
 * Shortcode "Contacts" output
 *
 * Mapped params are in {@path appica-core/inc/vc-map.php} {@see $appica_contacts}
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
// this shortcode use $content
$a = shortcode_atts(array('title' => '', 'subtitle' => '', 'extra_class' => '', 'location' => '', 'is_zoom' => 'disable', 'zoom' => 14, 'is_scroll' => 'disable', 'marker' => '', 'gm_custom' => ''), $atts);
// enqueue Google Maps API script
wp_enqueue_script('appica-google-maps');
$c_class = Appica_Helpers::get_class_set(array('fw-container', $a['extra_class']));
$title = '' === $a['title'] ? '' : esc_html($a['title']);
$subtitle = '' === $a['subtitle'] ? '' : esc_html($a['subtitle']);
$location = '' === $a['location'] ? '' : esc_html($a['location']);
$is_zoom = 'enable' === $a['is_zoom'];
$zoom = is_numeric($a['zoom']) ? absint($a['zoom']) : 14;
$is_scroll = 'enable' === $a['is_scroll'];
$custom = '' === $a['gm_custom'] ? '' : urldecode(base64_decode($a['gm_custom']));
$marker = '' === $a['marker'] ? '' : wp_get_attachment_image_src(absint($a['marker']), 'full');
$content = do_shortcode(shortcode_unautop($content));
// Prepare data attributes
$attributes = array('' === $title ? '' : "data-title=\"{$title}\"", '' === $location ? '' : "data-location=\"{$location}\"", '' === $marker ? '' : "data-icon=\"{$marker[0]}\"", $is_zoom ? 'data-is-zoom="1"' : 'data-is-zoom="0"', "data-zoom=\"{$zoom}\"", $is_scroll ? 'data-is-scroll="1"' : 'data-is-scroll="0"');
$data = implode(' ', array_filter($attributes));
$block_heading = '';
if ('' !== $title || '' !== $subtitle) {
    $block_heading .= '<div class="block-heading">';
Esempio n. 17
0
<?php

/**
 * Shortcode "Video Popup" output
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
$a = shortcode_atts(array('text' => '', 'video' => '', 'extra_class' => ''), $atts);
$text = esc_html($a['text']);
$video = esc_url($a['video']);
$class = Appica_Helpers::get_class_set(array('video-popup', $a['extra_class']));
printf('<div class="video-block"><a class="%3$s" href="%1$s"><i class="flaticon-play33"></i>%2$s</a></div>', $video, $text, $class);
foreach ($tablets as $post_id => $tablet) {
    $tpl = '<li id="ts%1$s">%2$s</li>';
    if ($first === $post_id) {
        // add class .active.in for first element
        $tpl = '<li class="active in" id="ts%1$s">%2$s</li>';
    }
    printf($tpl, $post_id, wp_get_attachment_image($tablet, 'full'));
}
unset($tablets, $tpl, $first, $post_id, $tablet);
?>
</ul>
				</div>
			</div>
			<div class="phone">
				<img src="<?php 
Appica_Helpers::image_uri("assets/img/iphone-{$color}.png");
?>
" alt="iPhone">
				<div class="mask">
					<ul class="screens"><?php 
/*
 * Phones
 */
$phones = array_key_exists('phones', $entries) ? (array) $entries['phones'] : array();
$first = null;
if (count($phones) > 0) {
    reset($phones);
    $first = key($phones);
}
foreach ($phones as $post_id => $phone) {
    $tpl = '<li id="ps%1$s">%2$s</li>';
Esempio n. 19
0
 /**
  * Return compiled css for <head>
  *
  * @since 1.0.0
  *
  * @return string
  */
 public static function get_head_css()
 {
     $css = array();
     $primary_color = Appica_Helpers::get_option('color_primary', '#007aff');
     $success_color = Appica_Helpers::get_option('color_success', '#4cd964');
     $info_color = Appica_Helpers::get_option('color_info', '#5ac8fa');
     $warning_color = Appica_Helpers::get_option('color_warning', '#ffcc00');
     $danger_color = Appica_Helpers::get_option('color_danger', '#ff2d55');
     // Button color
     $css[] = Appica_Helpers::generate_css_rules('.appica-button-color .primary', array('background-color' => $primary_color));
     $css[] = Appica_Helpers::generate_css_rules('.appica-button-color .success', array('background-color' => $success_color));
     $css[] = Appica_Helpers::generate_css_rules('.appica-button-color .info', array('background-color' => $info_color));
     $css[] = Appica_Helpers::generate_css_rules('.appica-button-color .warning', array('background-color' => $warning_color));
     $css[] = Appica_Helpers::generate_css_rules('.appica-button-color .danger', array('background-color' => $danger_color));
     // Badge color
     $css[] = Appica_Helpers::generate_css_rules('.appica-badge-color .primary', array('background-color' => $primary_color));
     $css[] = Appica_Helpers::generate_css_rules('.appica-badge-color .success', array('background-color' => $success_color));
     $css[] = Appica_Helpers::generate_css_rules('.appica-badge-color .info', array('background-color' => $info_color));
     $css[] = Appica_Helpers::generate_css_rules('.appica-badge-color .warning', array('background-color' => $warning_color));
     $css[] = Appica_Helpers::generate_css_rules('.appica-badge-color .danger', array('background-color' => $danger_color));
     return implode(PHP_EOL, $css);
 }
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
/*
 * This shortcode uses $content
 */
if (!function_exists('wpb_js_remove_wpautop')) {
    return;
}
$a = shortcode_atts(array('title' => '', 'subtitle' => '', 'image' => '', 'align' => 'left', 'extra_class' => ''), $atts);
$title = esc_html($a['title']);
$subtitle = esc_html($a['subtitle']);
$image = absint($a['image']);
$is_right = 'right' === $a['align'];
$classes = Appica_Helpers::get_class_set(array('split-block', $is_right ? 'img-right' : 'img-left', $a['extra_class']));
// Image
$_image = wp_get_attachment_image($image, 'full');
if ('' !== $_image) {
    $_image = "<div class=\"column\">{$_image}</div>";
}
// Content
$_heading = '';
if ('' !== $title || '' !== $subtitle) {
    $_heading = sprintf('<div class="block-heading">%1$s%2$s</div>', "<h2>{$title}</h2>", "<span>{$subtitle}</span>");
}
// 1 - heading, 2 - content
$_content = sprintf('<div class="column">%1$s%2$s</div>', $_heading, wpb_js_remove_wpautop($content, true));
// 1 - image, 2 - content, 3 - classes
$_tpl = $is_right ? '<div class="%3$s">%2$s%1$s</div>' : '<div class="%3$s">%1$s%2$s</div>';
printf($_tpl, $_image, $_content, $classes);
 /**
  * Show social meta box.
  *
  * @param WP_Post $post Post object
  */
 public function render_social_mb($post)
 {
     wp_nonce_field($this->nonce, $this->nonce_field);
     $networks = Appica_Helpers::get_social_networks_list();
     $socials = get_post_meta($post->ID, $this->mb_social_name, true);
     echo '<p>', __('Choose social networks for displaying', 'appica'), '</p>';
     echo '<div class="appica-social-networks-wrap">';
     if (!empty($socials)) {
         $this->render_networks_list($this->mb_social_name, $networks, $socials);
     } else {
         $this->render_empty_list($this->mb_social_name, $networks);
     }
     echo '</div><br>';
     // close .appica-social-networks-wrap
     echo '<button type="button" class="button button-primary appica-add-social-network">', __('Add one more social network', 'appica'), '</button>';
 }
Esempio n. 22
0
<?php

/**
 * Shortcode "App Gallery" output
 *
 * @since      1.0.0
 *
 * @author     8guild
 * @package    Appica
 * @subpackage Core
 */
$a = shortcode_atts(array('extra_class' => ''), $atts);
$class = Appica_Helpers::get_class_set(array('scroller', 'app-gallery', $a['extra_class']));
$query = new WP_Query(array('post_type' => 'appica_app_gallery', 'post_status' => 'publish', 'posts_per_page' => -1, 'ignore_sticky_posts' => true));
if ($query->have_posts()) {
    ?>
<div class="<?php 
    echo $class;
    ?>
"><?php 
    $tpl = '<a href="%2$s">%1$s</a>';
    $i = 1;
    while ($query->have_posts()) {
        $query->the_post();
        $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
        $r = $i % 3;
        /*
         * Show large & small previews
         *
         * First item wrap to div.item, each second and third item combine and wrap to div.item together
         */