-
AuthorSearch Results
-
March 6, 2017 at 12:09 pm #94874
In reply to: infinite scroll classipress theme
AnonymousInactive<?php
/**
* Setup ClassiPost Child Theme textdomain.
*
* Declare textdomain for this child theme.
* Translations can be filed in the /languages/ directory.
*/
function classipost_theme_setup() {
load_child_theme_textdomain( ‘classipost’, get_stylesheet_directory() . ‘/languages’ );
/**
* Add image sizes
*/
add_theme_support( ‘post-thumbnails’ );
add_image_size( ‘ad-thumb’, 75, 75, true );
add_image_size( ‘ad-medium’, 450, 300, true );
add_image_size( ‘ad-featured’, 500, 500, true );
add_image_size( ‘ad-large’, 725, 490, true );
}
add_action( ‘after_setup_theme’, ‘classipost_theme_setup’ );
/*
* Load the Options Panel
*/
define( ‘OPTIONS_FRAMEWORK_DIRECTORY’, get_stylesheet_directory_uri() . ‘/inc/’ );
require_once dirname( __FILE__ ) . ‘/inc/options-framework.php’;
// Loads options.php from child or parent theme
$optionsfile = locate_template( ‘options.php’ );
load_template( $optionsfile );
add_action( ‘optionsframework_after’, ‘optionscheck_display_sidebar’ );
function optionscheck_display_sidebar() { ?>
<div id=”optionsframework-sidebar”>
<div class=”metabox-holder”>
<div class=”postbox”>
<h3>ClassiPost Child Theme</h3>
<div class=”inside”>
<p>If you’ve reached this far, you probably bought this child theme and you’re looking to set it up for your own needs.</p>
<p>Don’t forget to follow the installation steps and also to save these options for the first time.</p>
<p>Feel free to look around and change these settings as you want.</p>
<p>If you need general help regarding this child theme, or you think you found bugs, you can ask for support on the dedicated forum.</p>
<p>NOTE: <i>I do not provide support for <u>custom development</u> of the Child Theme. I will generally answer such questions with guidance and even small code samples but do not expect me to do all your work.</i></p>
</div>
</div>
</div>
</div>
<?php }
/*
* This function loads an additional CSS file for the options panel
* which allows us to style the sidebar
*/
if ( is_admin() ) {
$of_page= ‘classipress_page_classipost-options’;
add_action( “admin_print_styles-$of_page”, ‘optionsframework_custom_css’, 100);
}
function optionsframework_custom_css () {
wp_enqueue_style(
‘optionsframework-custom-css’,
get_stylesheet_directory_uri() .’/inc/css/options-custom.css’
);
}
/*
* This one shows/hides the location option when a radio box is clicked.
*/
add_action( ‘optionsframework_custom_scripts’, ‘optionsframework_custom_scripts’ );
function optionsframework_custom_scripts() {
if (is_admin()) {
?>
<script type=”text/javascript”>
jQuery(document).ready(function($) {
$(‘#section-classipost_custom_meta’).hide();
$(‘input[name=classipost-child-theme\\[classipost_location\\]]’).change(function () { //use change event
if (this.value == ‘custom_location_field’) { //check value if it is custom_location_field
$(‘#section-classipost_custom_meta’).stop(true,true).show(500); //than show
} else {
$(‘#section-classipost_custom_meta’).stop(true,true).hide(500); //else hide
}
});
});
</script>
<?php
}
}
add_action(‘admin_init’,’optionscheck_change_santiziation’, 100);
function optionscheck_change_santiziation() {
remove_filter( ‘of_sanitize_textarea’, ‘of_sanitize_textarea’ );
add_filter( ‘of_sanitize_textarea’, ‘of_sanitize_textarea_custom’ );
}
function of_sanitize_textarea_custom($input) {
return $input;
}
function of_get_default( $option ) {
$defaults = optionsframework_options();
if ( isset( $defaults[$option][‘std’] ) ) {
return $defaults[$option][‘std’];
}
return false; // default if no std is set
}
/* Convert hexdec color string to rgb(a) string */
function hex2rgba($color, $opacity = false) {
$default = ‘rgb(255,204,51)’;
//Return default if no color provided
if(empty($color))
return $default;
//Sanitize $color if “#” is provided
if ($color[0] == ‘#’ ) {
$color = substr( $color, 1 );
}
//Check if color has 6 or 3 characters and get values
if (strlen($color) == 6) {
$hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
} elseif ( strlen( $color ) == 3 ) {
$hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
} else {
return $default;
}
//Convert hexadec to rgb
$rgb = array_map(‘hexdec’, $hex);
//Check if opacity is set(rgba or rgb)
if($opacity){
if(abs($opacity) > 1)
$opacity = 1.0;
$output = ‘rgba(‘.implode(“,”,$rgb).’,’.$opacity.’)’;
} else {
$output = ‘rgb(‘.implode(“,”,$rgb).’)’;
}
//Return rgb(a) color string
return $output;
}
/*
* Theme options custom CSS
*/
function classipost_inline_css(){
$classipost_layout = of_get_option(‘col-layout’, of_get_default(‘col-layout’));
$body_background = of_get_option(‘background_picker’, of_get_default(‘background_picker’ ));
$header_image = of_get_option(‘header_image’, of_get_default(‘header_image’ ));
$header_background = of_get_option(‘header_image’, of_get_default(‘header_image’ ));
$header_menu_text_color = of_get_option(‘header_menu_text_color’, of_get_default(‘header_menu_text_color’ ));
$header_text_color = of_get_option(‘header_text_color’, of_get_default(‘header_text_color’ ));
$header_height = of_get_option(‘header_height’, of_get_default(‘header_height’ ));
$color_searchbar = of_get_option(‘color_searchbar’, of_get_default(‘color_searchbar’ ));
$color_link = of_get_option(‘color_link’, of_get_default(‘color_link’ ));
$color_button = of_get_option(‘color_button’, of_get_default(‘color_button’ ));
$color_topbar = of_get_option(‘color_topbar’, of_get_default(‘color_topbar’ ));
$color_footer_menu = of_get_option(‘color_footer_menu’, of_get_default(‘color_footer_menu’ ));
$color_footer = of_get_option(‘color_footer’, of_get_default(‘color_footer’ ));
$custom_css = of_get_option(‘custom_css’, of_get_default(‘custom_css’ ));
?>
<style type=”text/css”>
<?php echo $classipost_layout; ?>
<?php if (!empty( of_get_option(‘background_picker’) != of_get_default(‘background_picker’ ))) { ?>
/* Dynamic Body Background Color or Image */
body {
background: <?php echo $body_background[‘color’] . ‘ url(‘ . $body_background[‘image’] . ‘) ‘ . $body_background[‘repeat’] . ‘ ‘ . $body_background[‘position’] . ‘ ‘ . $body_background[‘attachment’];?>;
}
<?php } ?>
<?php if ( of_get_option(‘custom_header’, of_get_default(‘custom_header’ )) == 1 ) { ?>
/* Dynamic Header Background Color or Image */
@media screen and (min-width:768px){
.header-image {
background: <?php echo ‘linear-gradient(‘. hex2rgba($header_background[‘color’],0.2) .’,’. hex2rgba($header_background[‘color’],0.2) .’)’,’, url(‘ . $header_background[‘image’] . ‘) ‘ . $header_background[‘repeat’] . ‘ ‘ . $header_background[‘position’] . ‘ ‘ . $header_background[‘attachment’];?>;
background-size: cover;
height: <?php echo $header_height; ?>;
margin-bottom: 15px;
}
<?php if (!empty( of_get_option(‘color_searchbar’) == of_get_default(‘color_searchbar’ ))) { ?>
.main-header.header-image {
border-top: 5px solid <?php echo $color_searchbar; ?>;
}
<?php } ?>
<?php if ( of_get_option(‘header_position’, of_get_default(‘header_position’ )) == 1 && of_get_option(‘color_searchbar’) == of_get_default(‘color_searchbar’ )) {?>
.header-image .search-wrap {
padding-top: 10px;
}
<?php } ?>
.header-message h1.header-title, .header-message .header-text {
color: <?php echo $header_text_color; ?>;
filter: drop-shadow(0 2px 5px rgba(0,0,0,0.7));
}
.header-message {
margin: 10px 10px 50px 10px;
}
.header-message .btn-lg {
font-size: 24px;
font-weight: 700;
}
#primary-menu.header-menu-home .navbar-nav>li>a {
color: <?php echo $header_menu_text_color; ?>;
}
}
<?php } ?>
<?php if (!empty( of_get_option(‘color_topbar’) != of_get_default(‘color_topbar’ ))) { ?>
/* Dynamic Top Bar Color */
.top-header {
background: <?php echo $color_topbar; ?>;
}
<?php } ?>
<?php if (!empty( of_get_option(‘color_searchbar’) != of_get_default(‘color_searchbar’ ))) { ?>
/* Dynamic Search Bar Color */
#affix-menu.affix-top {
background: <?php echo hex2rgba($color_searchbar, 0.3); ?>;
}
#affix-menu.affix {
background: <?php echo hex2rgba($color_searchbar, 0.5); ?>;
}
<?php } ?>
<?php if (!empty( of_get_option(‘color_link’) != of_get_default(‘color_link’ ))) { ?>
/* Dynamic Links Color */
a{
color: <?php echo $color_link; ?>;
}
a:hover, a:focus {
color: <?php echo $color_link; ?>;
}
<?php } ?>
<?php if (!empty( of_get_option(‘color_button’) != of_get_default(‘color_button’ ))) { ?>
/* Dynamic Button Color */
.orangebutton {
background-color: <?php echo $color_button; ?>;
border-color: <?php echo $color_button; ?>;
}
.orangebutton:hover {
background-color: <?php echo $color_button; ?>;
border-color: <?php echo $color_button; ?>;
}
.btn_orange,
.reports_form input[type=”submit”] {
background-color: <?php echo $color_button; ?>;
}
.btn_orange:hover,
.order-gateway input[type=”submit”]:hover,
.reports_form input[type=”submit”]:hover {
background-color: <?php echo $color_button; ?>;
}
<?php } ?>
<?php if (!empty( of_get_option(‘color_footer_menu’) != of_get_default(‘color_footer_menu’ ))) { ?>
/* Dynamic Footer Menu Color */
.footer-nav-menu {
background: <?php echo $color_footer_menu; ?>;
}
<?php } ?>
<?php if (!empty( of_get_option(‘color_footer’) != of_get_default(‘color_footer’ ))) { ?>
/* Dynamic Footer Background Color */
.footer {
background: <?php echo $color_footer; ?>;
}
<?php } ?>
<?php if (!empty( of_get_option(‘custom_css’) != of_get_default(‘custom_css’ ))) { ?>
/* Dynamic Custom CSS */
<?php echo $custom_css; ?>
<?php } ?>
</style>
<?php
}
add_action(‘wp_head’,’classipost_inline_css’);
// Load different color stylesheet
function options_stylesheets_alt_style() {
if ( of_get_option( ‘stylesheet’, of_get_default(‘stylesheet’ ) ) ) {
wp_enqueue_style( ‘options_stylesheets_alt_style’, of_get_option(‘stylesheet’, of_get_default(‘stylesheet’ )), array(), null );
}
}
add_action( ‘wp_enqueue_scripts’, ‘options_stylesheets_alt_style’, 100 );
/**
* Load ClassiPost custom scripts
*/
function classipost_enqueue_scripts() {
global $cp_options;
// reload gmaps with geolocation support
wp_deregister_script( ‘google-maps’ );
$gmap_params = array(
‘language’ => $cp_options->gmaps_lang,
‘region’ => $cp_options->gmaps_region,
‘libraries’ => ‘places’
);
if ( $cp_options->api_key ) {
$gmap_params[‘key’] = $cp_options->api_key;
}
$google_maps_url = ( is_ssl() ? ‘https’ : ‘http’ ) . ‘://maps.googleapis.com/maps/api/js’;
$google_maps_url = add_query_arg( $gmap_params, $google_maps_url );
$protocol = is_ssl() ? ‘https’ : ‘http’;
wp_enqueue_script(‘bootstrap-js’, get_stylesheet_directory_uri() . ‘/js/bootstrap.min.js’, false, ‘3.3.6’);
wp_enqueue_script(‘bootstrap-select-js’, get_stylesheet_directory_uri() . ‘/js/bootstrap-select.min.js’, false, ‘1.10.0’);
wp_enqueue_script(‘bootstrap-dropdown-js’, get_stylesheet_directory_uri() . ‘/js/bootstrap-hover-dropdown.min.js’, false, ‘2.2.1’);
wp_enqueue_script(‘tabcollapse-js’, get_stylesheet_directory_uri() . ‘/js/bootstrap-tabcollapse.js’, false, ‘1.0.0’);
if ( is_single() ) {
wp_enqueue_script(‘lightgallery-js’, get_stylesheet_directory_uri() . ‘/js/lightgallery/js/lightgallery-all.min.js’, false, ‘1.4.4’);
wp_enqueue_script(‘mousewheel-js’, get_stylesheet_directory_uri() . ‘/js/jquery.mousewheel.min.js’, false, ‘3.1.12’);
}
wp_enqueue_script(‘owl-carousel-js’, get_stylesheet_directory_uri() . ‘/js/owl.carousel2.min.js’, false, ‘2.1.1’);
if (of_get_option(‘infinitescroll’, of_get_default(‘infinitescroll’ )) == ‘infinite’) {
wp_enqueue_script(‘infinitescroll’, get_stylesheet_directory_uri() . ‘/js/jquery.infinitescroll.min.js’, array(‘jquery’), ‘1.1’);
}
if ( is_page_template( ‘tpl-ads-home.php’ ) && of_get_option(‘custom_header’, of_get_default(‘custom_header’ )) == 1 ) {
wp_enqueue_script(‘typed’, get_stylesheet_directory_uri() . ‘/js/typed.min.js’, array(‘jquery’), ‘1.1.4’);
}
wp_enqueue_script( ‘google-maps’, $google_maps_url, array( ‘jquery’ ), ‘3.0’ );
if (of_get_option(‘classipost_location’, of_get_default(‘classipost_location’ )) == ‘city_geolocation’) {
wp_enqueue_script(‘geotext-js’, get_stylesheet_directory_uri() . ‘/js/geotext.min.js’, false, ‘1.0.0’);
}
wp_enqueue_script(‘classipost-js’, get_stylesheet_directory_uri() . ‘/js/classipost.js’, false, ‘1.0.0’);
// only load the general.js if available in child theme
if ( file_exists( get_stylesheet_directory() . ‘/js/custom.js’ ) ) {
wp_enqueue_script( ‘custom-js’, get_stylesheet_directory_uri() . ‘/js/custom.js’, array( ‘jquery’ ), ‘1.0’ );
}
}
add_action( ‘wp_enqueue_scripts’, ‘classipost_enqueue_scripts’, 99 );
/**
* Enqueue both Parent and child theme stylesheets.
* This makes sure that the child theme stylesheet is loaded after the parent sheet.
*/
function classipost_enqueue_styles() {
$protocol = is_ssl() ? ‘https’ : ‘http’;
$parent_style = ‘at-main’;
wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style(‘bootstrap’, get_stylesheet_directory_uri() . ‘/js/assets/bootstrap.min.css’, false, ‘3.3.6’);
wp_deregister_style( ‘font-awesome’);
wp_register_style( ‘font-awesome’, get_stylesheet_directory_uri() . ‘/js/assets/font-awesome.min.css’, false, ‘4.6.3’ );
wp_enqueue_style( ‘font-awesome’);
wp_enqueue_style(‘bootstrap-select-css’, get_stylesheet_directory_uri() . ‘/js/assets/bootstrap-select.min.css’, false, ‘1.10.0’);
wp_enqueue_style(‘owl-carousel’, get_stylesheet_directory_uri() . ‘/js/assets/owl.carousel.min.css’, false, ‘2.1.1’);
wp_enqueue_style(‘owl-theme’, get_stylesheet_directory_uri() . ‘/js/assets/owl.theme.default.min.css’, false, ‘2.1.1’);
if ( is_single() ) {
wp_enqueue_style(‘lightgallery’, get_stylesheet_directory_uri() . ‘/js/lightgallery/css/lightgallery.min.css’, false, ‘1.4.4’);
}
wp_enqueue_style(‘classipost-main’, get_stylesheet_directory_uri() . ‘/style.css’, array( $parent_style ) );
}
add_action( ‘wp_enqueue_scripts’, ‘classipost_enqueue_styles’ );
// Remove Classipress color stylesheets
function classipost_dequeue_styles() {
wp_dequeue_style( ‘at-color’);
wp_dequeue_style( ‘open-sans’ );
wp_dequeue_script( ‘tinynav’);
wp_dequeue_script( ‘selectbox’);
wp_dequeue_script( ‘jqueryeasing’);
wp_dequeue_script( ‘jcarousellite’);
wp_dequeue_script( ‘colorbox’ );
}
add_action( ‘wp_enqueue_scripts’, ‘classipost_dequeue_styles’, 99 );
/**
* Remove emoji
*/
function disable_wp_emojicons() {
// all actions related to emojis
remove_action( ‘admin_print_styles’, ‘print_emoji_styles’ );
remove_action( ‘wp_head’, ‘print_emoji_detection_script’, 7 );
remove_action( ‘admin_print_scripts’, ‘print_emoji_detection_script’ );
remove_action( ‘wp_print_styles’, ‘print_emoji_styles’ );
remove_filter( ‘wp_mail’, ‘wp_staticize_emoji_for_email’ );
remove_filter( ‘the_content_feed’, ‘wp_staticize_emoji’ );
remove_filter( ‘comment_text_rss’, ‘wp_staticize_emoji’ );
// filter to remove TinyMCE emojis
add_filter( ‘tiny_mce_plugins’, ‘disable_emojicons_tinymce’ );
// remove DNS prefetch
add_filter( ’emoji_svg_url’, ‘__return_false’ );
}
add_action( ‘init’, ‘disable_wp_emojicons’ );
function disable_emojicons_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( ‘wpemoji’ ) );
} else {
return array();
}
}
/**
* Remove cp color customizer for now
*/
function remove_color_customizer() {
remove_action( ‘wp_head’, ‘_cp_customize_css’, 999 );
remove_action( ‘customize_controls_enqueue_scripts’, ‘_cp_enqueue_customizer_color_previewer’ );
remove_action( ‘customize_register’, ‘_cp_customize_color_scheme’ );
//remove_action( ‘after_setup_theme’, ‘cp_custom_header_setup’ );
remove_action( ‘customize_register’, ‘_cp_customize_site’ );
remove_action( ‘customize_register’, ‘_cp_customize_footer’ );
}
add_action (‘init’, ‘remove_color_customizer’);
/**
* Register top menu navigation positioon
*/
function classipost_register_top_menu() {
register_nav_menu( ‘Top’, __( ‘Top Navigation’, ‘classipost’ ) );
if ( !is_nav_menu( ‘Top’ )) {
$menu_id = wp_create_nav_menu( ‘Top’ );
$menu = array( ‘menu-item-type’ => ‘custom’, ‘menu-item-url’ => get_home_url(‘/’),’menu-item-title’ => ‘Home’ );
wp_update_nav_menu_item( $menu_id, 0, $menu );
}
}
add_action( ‘init’, ‘classipost_register_top_menu’ );
/**
*Register bootstrap navigation walker
*/
require_once(get_stylesheet_directory().’/wp_bootstrap_navwalker.php’);
/**
* Displays ad thumbnail. Use in the loop.
*
* @return void
*/
if ( ! function_exists( ‘cp_ad_loop_thumbnail’ ) ) :
function cp_ad_loop_thumbnail() {
global $post, $cp_options;
// go see if any images are associated with the ad
$image_id = cp_get_featured_image_id( $post->ID );
// set the class based on if the hover preview option is set to “yes”
$prevclass = ( $cp_options->ad_image_preview ) ? ‘preview’ : ‘nopreview’;
if ( $image_id > 0 ) {
// get 450×300 image size
$adthumbarray = wp_get_attachment_image( $image_id, ‘ad-medium’ );
// grab the large image for onhover preview
$adlargearray = wp_get_attachment_image_src( $image_id, ‘ad-large’ );
$img_large_url_raw = $adlargearray[0];
// must be a v3.0.5+ created ad
if ( $adthumbarray ) {
echo ‘‘. $adthumbarray .’‘;
// maybe a v3.0 legacy ad
} else {
$adthumblegarray = wp_get_attachment_image_src($image_id, ‘thumbnail’);
$img_thumbleg_url_raw = $adthumblegarray[0];
echo ‘‘. $adthumblegarray .’‘;
}
// no image so return the placeholder thumbnail
} else {
}
}
endif;
/**
* Displays ad thumbnail for featured ads. Use in the loop.
*
* @return void
*/
if ( ! function_exists( ‘cp_ad_featured_thumbnail’ ) ) :
function cp_ad_featured_thumbnail() {
global $post, $cp_options;
// go see if any images are associated with the ad
$image_id = cp_get_featured_image_id( $post->ID );
// set the class based on if the hover preview option is set to “yes”
$prevclass = ( $cp_options->ad_image_preview ) ? ‘preview’ : ‘nopreview’;
if ( $image_id > 0 ) {
// get 500×500 image size
$adthumbarray = wp_get_attachment_image( $image_id, ‘ad-featured’ );
// grab the large image for onhover preview
$adlargearray = wp_get_attachment_image_src( $image_id, ‘ad-large’ );
$img_large_url_raw = $adlargearray[0];
// must be a v3.0.5+ created ad
if ( $adthumbarray ) {
echo ‘‘. $adthumbarray .’‘;
// maybe a v3.0 legacy ad
} else {
$adthumblegarray = wp_get_attachment_image_src($image_id, ‘thumbnail’);
$img_thumbleg_url_raw = $adthumblegarray[0];
echo ‘‘. $adthumblegarray .’‘;
}
// no image so return the placeholder thumbnail
} else {
}
}
endif;
/**
* Displays all the images and thumbnails for the single page ad with support for Owl Carousel 2.
*
* @param int $post_id (optional)
* @param string $size (optional)
* @param string $title (optional)
*
* @return void
*/
if ( ! function_exists( ‘cp_get_image_url_single’ ) ) {
function cp_get_image_url_single( $post_id = ”, $size = ”, $title = ” ) {
$attachment_query = array(
‘post_type’ => ‘attachment’,
‘post_status’ => null,
‘post_parent’ => $post_id,
‘order’ => ‘ASC’,
‘orderby’ => ‘ID’,
‘no_found_rows’ => true
);
$attachment_ids = get_post_meta( $post_id, ‘_app_media’, true );
if ( ! empty( $attachment_ids ) ) {
$attachment_query = array_merge( $attachment_query, array(
‘post__in’ => $attachment_ids,
‘orderby’ => ‘post__in’
) );
}
// go see if any images are associated with the ad
$images = get_children( $attachment_query );
$image_count = cp_count_ad_images($post_id);
$i = 1;
if ( $images ) {
foreach ( $images as $image ) {
$alt = get_post_meta( $image->ID, ‘_wp_attachment_image_alt’, true );
if ( empty( $alt ) ) {
$alt = $title . ‘ – ‘ . __( ‘Image ‘, APP_TD ) . $i;
}
$iarray = wp_get_attachment_image_src( $image->ID, $size, $icon = false );
$farray = wp_get_attachment_image_src( $image->ID, ‘full’, $icon = false );
//$image_count = cp_count_ad_images($post_id);
if ( $image_count > 1 ) {
$tarray = wp_get_attachment_image_src( $image->ID, ‘ad-thumb’, $icon = false );
echo ‘<div class=”ad-thumb” data-src=”‘. $farray[0] .'” data-thumb=”‘. $tarray[0] .'” data-dot=”“></div>’;
}
if ( $image_count == 1 ) {
echo ‘<div class=”ad-thumb” data-src=”‘. $farray[0] .'”></div>’;
}
$i++;
}
}
if ( $image_count < 1 ) {
echo ‘<div></div>’;
}
}
}
add_action( ‘init’ , ‘classipost_remove_ad_actions’ );
function classipost_remove_ad_actions() {
remove_action( ‘appthemes_before_post_title’, ‘cp_ad_loop_price’ );
remove_action( ‘appthemes_after_post_title’, ‘cp_ad_loop_meta’ );
remove_action( ‘appthemes_after_post_content’, ‘cp_do_loop_stats’ );
remove_action( ‘appthemes_after_blog_post_content’, ‘cp_do_loop_stats’ );
remove_action(‘appthemes_after_blog_post_title’, ‘cp_blog_post_meta’);
remove_action( ‘appthemes_advertise_content’, ‘cp_adbox_336x280’ );
remove_action( ‘appthemes_after_loop’, ‘cp_single_ad_banner’ );
// Replace them with own functions
add_action( ‘appthemes_before_post_title’, ‘classipost_ad_loop_price’ );
add_action( ‘cp_action_after_ad_details’, ‘classipost_ad_single_price’, 10, 3 );
add_action( ‘appthemes_after_post_title’, ‘classipost_ad_loop_meta’ );
add_action( ‘appthemes_after_post_content’, ‘classipost_do_loop_stats’ );
add_action( ‘appthemes_after_blog_post_content’, ‘classipost_do_loop_stats’ );
add_action(‘appthemes_after_blog_post_title’, ‘classipost_blog_post_meta’);
add_action( ‘appthemes_before_post_content’, ‘cp_single_ad_banner’ );
add_action( ‘appthemes_advertise_content’, ‘classipost_adbox_728x90’ );
}
/**
* Displays 728 x 90 ad box on single page.
* @since 3.3
*
* @return void
*/
function classipost_adbox_728x90() {
global $cp_options;
if ( ! $cp_options->adcode_336x280_enable ) {
return;
}
?>
<div class=”shadowblock_out”>
<div class=”shadowblock px2″>
<div class=”ablock”>
<?php
if ( ! empty( $cp_options->adcode_336x280 ) ) {
echo stripslashes( $cp_options->adcode_336x280 );
} elseif ( $cp_options->adcode_336x280_url ) {
$img = html( ‘img’, array( ‘src’ => $cp_options->adcode_336x280_url, ‘border’ => ‘0’, ‘alt’ => ” ) );
echo html( ‘a’, array( ‘href’ => $cp_options->adcode_336x280_dest, ‘target’ => ‘_blank’ ), $img );
}
?>
</div>
</div>
</div>
<?php
}
/**
* Displays 728 x 90 ad box on the home page under the slider.
* @since 3.3
*
* @return void
*/
function classipost_homepage_728x90() {
global $cp_options;
if ( ! $cp_options->adcode_468x60_enable ) {
return;
}
?>
<div class=”shadowblock_out”>
<div class=”shadowblock px2″>
<div class=”ablock”>
<?php
if ( ! empty( $cp_options->adcode_468x60 ) ) {
echo stripslashes( $cp_options->adcode_468x60 );
} else {
if ( ! $cp_options->adcode_468x60_url ) {
$img = html( ‘img’, array( ‘src’ => get_template_directory_uri() . ‘/images/468×60-banner.jpg’, ‘width’ => ‘468’, ‘height’ => ’60’, ‘border’ => ‘0’, ‘alt’ => ‘Premium WordPress Themes – AppThemes’ ) );
echo html( ‘a’, array( ‘href’ => ‘https://www.appthemes.com’, ‘target’ => ‘_blank’ ), $img );
} else {
$img = html( ‘img’, array( ‘src’ => $cp_options->adcode_468x60_url, ‘border’ => ‘0’, ‘alt’ => ” ) );
echo html( ‘a’, array( ‘href’ => $cp_options->adcode_468x60_dest, ‘target’ => ‘_blank’ ), $img );
}
}
?>
</div>
</div>
</div>
<?php
}
/**
* Adds the ad price field in the loop before the ad title.
* @since 3.1.3
*
* @return void
*/
function classipost_ad_loop_price() {
global $post;
$price = get_post_meta($post->ID, ‘cp_price’, true);
if ( $post->post_type == ‘page’ || $post->post_type == ‘post’ || empty($price) || $price == 0 || is_singular( APP_POST_TYPE ))
return;
?>
<div class=”price-wrap”>
<p class=”post-price”>
<?php cp_get_price( $post->ID, ‘cp_price’ ); ?>
</p>
</div>
<?php
}
function classipost_ad_single_price( $form_fields, $post, $location = ‘list’) {
global $post;
$price = get_post_meta($post->ID, ‘cp_price’, true);
if ( $post->post_type == ‘page’ || $post->post_type == ‘post’ || empty($price) || $price == 0)
return;
if ( is_singular( APP_POST_TYPE ) && $location == ‘list’ ) { ?>
<li id=”cp_price”><span><?php _e( ‘Price:’, APP_TD ); ?></span> <?php cp_get_price( $post->ID, ‘cp_price’ ); ?>
<?php
}
}
/**
* Adds the ad meta in the loop after the ad title.
* @since 3.1
*
* @return void
*/
function classipost_ad_loop_meta() {
global $post, $cp_options;
if ( is_singular( APP_POST_TYPE ) )
return;
$classipost_meta = of_get_option(‘classipost_custom_meta’, of_get_default(‘classipost_custom_meta’ ));
$custom_meta = get_post_meta($post->ID, $classipost_meta, true);
$category_meta = get_the_term_list( $post->ID, APP_TAX_CAT, ”, ‘, ‘, ” );
$category_location = get_the_terms( $post->ID, APP_TAX_CAT);
if ($category_location && ! is_wp_error($category_location)) {
foreach ($category_location as $term){
$category_link = get_term_link($term, APP_TAX_CAT );
}
}
?>
<p class=”item-meta”>
<span class=”nowsp”><i class=”fa fa-folder-open”></i> <?php if ( $post->post_type == ‘post’ ) the_category(‘, ‘); else echo $category_meta; ?></span>
<?php $classipost_author = get_the_author_meta(‘ID’);
if ( is_user_online($classipost_author)) { ?>
<span class=”nowsp” rel=”tooltip” data-placement=”top” data-original-title=” <?php printf (__( ‘%s is Online’, ‘classipost’ ), get_the_author_meta(‘display_name’)) ?> “><i class=”fa fa-user icon-pulse” style=”color:dimgray”></i> <?php the_author_posts_link(); ?></span>
<?php } else { ?>
<span class=”nowsp” rel=”tooltip” data-placement=”top” data-original-title=” <?php _e( ‘Last Login:’, APP_TD ); ?> <?php echo appthemes_get_last_login( get_the_author_meta(‘ID’) ); ?> “><i class=”fa fa-user”></i> <?php the_author_posts_link(); ?></span>
<?php } ?>
<span class=”nowsp”><i class=”fa fa-map-marker”></i> ?<?php if ($classipost_meta == ‘cp_city’) echo $classipost_meta; else echo $classipost_meta.'[]’; ?>=<?php echo $custom_meta;?>&sa=search&refine_search=yes” title=”<?php echo $custom_meta; ?>”> <?php echo $custom_meta; ?> </span>
<span class=”nowsp”><i class=”fa fa-clock-o”></i> <?php echo appthemes_date_posted($post->post_date); ?></span>
<?php if ( $cp_options->ad_stats_all && current_theme_supports( ‘app-stats’ ) ) { ?>
<span class=”nowsp”><i class=”fa fa-signal”></i> <?php appthemes_stats_counter( $post->ID ); ?></span>
<?php } ?>
</p>
<?php
}
// Post meta
function classipost_blog_post_meta() {
if ( is_page() ) return; // don’t do post-meta on pages
global $post;
?>
<p class=”post-meta”><span class=”nowsp”><i class=”fa fa-user fa-lg”></i> <?php the_author_posts_link(); ?></span> <span class=”nowsp”><i class=”fa fa-folder-open fa-lg”></i> <?php the_category(‘, ‘) ?></span> <span class=”nowsp”><i class=”fa fa-clock-o fa-lg”></i> <?php echo appthemes_date_posted( $post->post_date ); ?></span></p>
<?php
}
function classipost_do_loop_stats() {
global $post, $cp_options;
if (( is_singular(‘post’) ) && $cp_options->ad_stats_all && current_theme_supports( ‘app-stats’ )) {
?>
<p class=”stats”><i class=”fa fa-signal”></i>
<?php appthemes_stats_counter( $post->ID ); ?>
</p>
<?php
}
}
// Get meta values of all ads, used mainly for top search location bar
function get_meta_values( $key = ”, $type = APP_POST_TYPE, $status = ‘publish’ ) {
global $wpdb;
if( empty( $key ) )
return;
$r = $wpdb->get_col( $wpdb->prepare( ”
SELECT DISTINCT pm.meta_value FROM {$wpdb->postmeta} pm
LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id
WHERE pm.meta_key = ‘%s’
AND p.post_status = ‘%s’
AND p.post_type = ‘%s’
ORDER BY meta_value ASC
“, $key, $status, $type ) );
return $r;
}
// Update user online status
function update_online_users_status(){
if(is_user_logged_in()){
// get the online users list
if(($logged_in_users = get_transient(‘users_online’)) === false) $logged_in_users = array();
$current_user = wp_get_current_user();
$current_user = $current_user->ID;
$current_time = current_time(‘timestamp’);
if(!isset($logged_in_users[$current_user]) || ($logged_in_users[$current_user] < ($current_time – (15 * 60)))){
$logged_in_users[$current_user] = $current_time;
set_transient(‘users_online’, $logged_in_users, 30 * 60);
}
}
}
add_action(‘wp’, ‘update_online_users_status’);
function is_user_online($user_id) {
global $wpdb;
// get the online users list
$logged_in_users = get_transient(‘users_online’);
// online, if (s)he is in the list and last activity was less than 15 minutes ago
return isset($logged_in_users[$user_id]) && ($logged_in_users[$user_id] > (current_time(‘timestamp’) – (15 * 60)));
}
// Unregister the footer sidebar
function remove_footer_sidebar(){
unregister_sidebar( ‘sidebar_footer’ );
}
add_action( ‘widgets_init’, ‘remove_footer_sidebar’ );
function classipost_register_sidebars() {
// Footer
$footer_columns = of_get_option(‘footer_columns’, of_get_default(‘footer_columns’ ));
register_sidebar( array(
‘name’ => __( ‘Footer’, APP_TD ),
‘id’ => ‘sidebar_footer’,
‘description’ => __( ‘This is your ClassiPress footer. You can have ANY number of widgets which will display in the footer from left to right.’, APP_TD ),
‘before_widget’ => ‘<div class=”footer-widget ‘ . $footer_columns . ‘ %2$s” id=”%1$s”>’,
‘after_widget’ => ‘</div><!– /footer-widget –>’,
‘before_title’ => ‘<h2 class=”dotted”>’,
‘after_title’ => ‘</h2>’,
) );
}
add_action( ‘widgets_init’, ‘classipost_register_sidebars’, 11 );
//Create bootstrap badges for categories within sidebar
function classipost_cat_count($links) {
$links = str_replace(‘ (‘, ‘ <span class=”badge badge-primary”>’, $links);
$links = str_replace(‘)’, ‘</span>’, $links);
return $links;
}
add_filter(‘wp_list_categories’, ‘classipost_cat_count’);
//Stick featured ads to the top on category and search pages
class StickyAds {
public function __construct() {
add_filter(‘posts_orderby’, array($this, ‘_hookPostsOrderBy’), 11, 2);
}
public function _hookPostsOrderBy($orderBy, $query) {
global $wpdb;
if ( is_tax(‘ad_cat’) || is_search() && !$query->query_vars[‘ignore_sticky_posts’]) {
$stickyPosts = get_option(‘sticky_posts’);
if (is_array($stickyPosts) && !empty($stickyPosts)) {
$sticky = ‘(‘ . $wpdb->posts . ‘.ID IN (‘ .
implode(‘,’, $stickyPosts) . ‘)) DESC’;
$orderBy= empty($orderBy) ? $sticky : $sticky . ‘,’ . $orderBy;
add_filter(
‘pre_option_sticky_posts’, array($this, ‘_hookOptionStickyPosts’)
);
}
}
return $orderBy;
}
public function _hookOptionStickyPosts($option) {
remove_filter(‘pre_option_sticky_posts’, array($this, ‘_hookOptionStickyPosts’)
);
return array();
}
}
$stickyads = new StickyAds();
// End sticky ads
function bootstrap_tabs_js() {
if (is_home() || is_front_page()) {
$active_tab = of_get_option(‘home_tab’, of_get_default(‘home_tab’ ));
} else {
$active_tab = 0;
}
?>
<script>
// Save current tab or pill active state in the local storage
jQuery(document).ready(function ($) {
var json, tabsState;
$(‘a[data-toggle=”pill”], a[data-toggle=”tab”]’).on(‘shown.bs.tab’, function(e) {
var href, json, parentId, tabsState;
tabsState = localStorage.getItem(“tabs-state”);
json = JSON.parse(tabsState || “{}”);
parentId = $(e.target).parents(“ul.nav.nav-pills, ul.nav.nav-tabs”).attr(“id”);
href = $(e.target).attr(‘href’);
json[parentId] = href;
return localStorage.setItem(“tabs-state”, JSON.stringify(json));
});
tabsState = localStorage.getItem(“tabs-state”);
json = JSON.parse(tabsState || “{}”);
$.each(json, function(containerId, href) {
return $(‘#’ + containerId + ‘ a[href=”‘ + href + ‘”]’).tab(‘show’);
});
$(“ul.nav.nav-pills, ul.nav.nav-tabs”).each(function() {
var $this = $(this);
if (!json[$this.attr(“id”)]) {
return $this.find(“a[data-toggle=tab]:eq(<?php echo $active_tab; ?>), a[data-toggle=pill]:eq(<?php echo $active_tab; ?>)”).tab(“show”);
}
$(‘.popular-tab.active, .random-tab.active’).trigger(“click”);
});
$(document).on(“shown.bs.collapse”, “.panel-collapse”, function (e) {
$(‘.popular-tab, .random-tab’).trigger(“click”);
});
});
// End pill or tab state
/* Bootstrap Accordion.
Turn the tabs into accordions on mobile devices.
Scroll to top and animate the accordion.
*/
jQuery(document).ready(function ($) {
$(“[id^=tabby-]”).tabCollapse({
tabsClass: ‘hidden-ms hidden-xs’,
accordionClass: ‘visible-ms visible-xs’
});
$(“[id$=’-accordion’]”).on(‘shown.bs.collapse’, function () {
var panel = $(this).find(‘.in’);
$(‘html, body’).animate({
scrollTop: panel.offset().top -57 }, 500);
});
});
// End Accordion
<?php if ( is_single() && ! of_get_option(‘remove_maps’, of_get_default(‘remove_maps’ )) == ‘1’ ) { ?>
// Initialize the Google map upon click on tabs
jQuery(document).ready(function($) {
var clicked = false;
if( $(“[id^=location]”).is(‘:visible’) ) {
map_init();
} else {
jQuery(‘a[href^=”#location”]’).click( function() {
if( !clicked ) {
map_init();
clicked = true;
}
});
}
});
jQuery(document).on(“shown.bs.collapse shown.bs.tab”, “.panel-collapse, a[data-toggle=’tab’]”, function (e) {
setTimeout(function(){
google.maps.event.trigger(map,’resize’);
}, 500);
});
<?php } ?>
</script>
<?php
}
add_action( ‘wp_footer’, ‘bootstrap_tabs_js’);
//Begin infinite scroll
function infinitescroll_js() {
if (of_get_option(‘infinitescroll’, of_get_default(‘infinitescroll’ )) == ‘infinite’) {
?>
<script>
jQuery(document).ready(function($) {
// infinite scroll
$(“.loop-items”).infinitescroll({
navSelector : “.paging”,
// selector for the paged navigation (it will be hidden)
nextSelector : “a.page-numbers”,
// selector for the NEXT link (to page 2)
itemSelector : “.wrap-item”,
// selector for all items you’ll retrieve
contentSelector : “.loop-items”,
loading: {
img: “<?php echo get_stylesheet_directory_uri(); ?>/images/ajax-loader.gif”,
msgText: “<?php _e( ‘Loading next ads…’, ‘classipost’ ); ?>”,
finishedMsg: “<?php _e( ‘This was the last ad from current category.’, ‘classipost’ ); ?>”
}
});
});
</script>
<?php
}
}
add_action( ‘wp_footer’, ‘infinitescroll_js’,100 );
// Available colors top menu
if ( class_exists(‘WPUserStylesheetSwitcher’) ) :
function stylesheet_switch_menu ( $items, $args ) {
if ( $args->theme_location == ‘Top’ ) {
global $wpUserStylesheetSwitcher;
$items = $wpUserStylesheetSwitcher->show_wp_user_stylesheet_switcher(array(‘list_title’=>’Colors: ‘, ‘show_list_title’=>’true’, ‘list_type’=>’icon’));
}
return $items;
}
add_filter( ‘wp_nav_menu_items’, ‘stylesheet_switch_menu’, 10, 2 );
endif;
// Enable the TinyMCE kitchen sink
function enable_more_buttons($buttons) {
$buttons[] = ‘fontselect’;
$buttons[] = ‘fontsizeselect’;
return $buttons;
}
add_filter(‘mce_buttons_2’, ‘enable_more_buttons’);
function add_search_filter_before_page_loop() {
do_action(‘search_filter_query_posts’, 3726);
}
add_action( ‘appthemes_before_blog_loop’, ‘add_search_filter_before_page_loop’ );
March 5, 2017 at 12:29 am #94579In reply to: Search & Filter Pro failing to work for me
AnonymousInactiveHi Ross.
I have added this code to my Marketify.js file but it’s not having the desired effect. You can see on the site how the nice layout still isn’t happening after a search is performed. My js code is below. Am I doing something wrong?
var Marketify = {}; Marketify.App = ( function($) { "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ var grid; $(el).find($('.edd_download.content-grid-download')).attr('style', ''); grid = document.querySelector(el); salvattore['register_grid'](grid); }); function menuToggle() { $( '.js-toggle-nav-menu--primary' ).click(function(e) { e.preventDefault(); $( '.nav-menu--primary' ).toggleClass( 'active' ); }); } function menuSearch() { $( '.js-toggle-search' ).click(function(e) { e.preventDefault(); $( '.search-form-overlay' ).toggleClass( 'active' ); }); } function footerHeight() { var checks = $( '.site-info, .footer-widget-areas' ); checks.each(function() { var min = 0; var children = $(this).children(); children.each(function() { if ( $(this).outerHeight() > min ) min = $(this).outerHeight(); }); if ( $(window).width() < 978 ) children.css( 'height', 'auto' ); else children.css( 'height', min ); }); } function soliloquySliders() { if ( $(window).width() < 500 ) { var sliders = $( '.soliloquy' ); $.each(sliders, function() { var image = $(this).find( 'img' ), src = image.prop( 'src' ); console.log( src ); $(this) .find( 'li' ) .css({ 'height' : $(window).outerHeight(), 'background-image' : 'url(' + src + ')', 'background-size' : 'cover' }); image.hide(); }); } } function initVideos() { var video = $( '.header-outer .wp-video video' ).get(0); if ( typeof video === 'undefined' ) { return; } var vide = $( '.header-outer .wp-video' ).vide(); vide.resize(); function adjustHeight() { if ( $(window).width() < 768 ) { $( video ).hide(); } else { $( video ).show(); } } adjustHeight(); $(window).resize(function() { adjustHeight(); }); return; } function initPurchaseForms() { $( '.buy-now.popup-trigger' ).on( 'click', function(e) { e.preventDefault(); $button = $(this); $form = $button.next(); Marketify.App.popup({ items : { src : '#marketify-price-options-popup', fixedContentPos: false, fixedBgPos: false, overflowY: 'scroll' }, callbacks: { beforeOpen: function() { $clone = $form.clone(); $( '#marketify-price-options' ).html( $clone ); } } }); }); } function initSectionTitles() { $( '.edd-slg-login-wrapper' ).each(function() { var link = $(this).find( 'a' ); var title = link.attr( 'title' ); link.html(title).prepend( '<span></span' ); }); // section title shims $( '.edd_form fieldset > span legend' ).unwrap(); var shims = [ $( '.gform_title' ), $( '.fes-form h1' ), $( '.fes-headers' ), $( '.edd_form *:not(span) > legend' ), $( '.pm-section-title' ), $( '.edd-reviews-title' ), $( '.edd-reviews-heading' ), $( '.edd-reviews-vendor-feedback-item h4' ), $( '.edd-csau-products h2' ), $( '#edd_checkout_user_info legend' ) ] $.each(shims, function() { if ( 0 === $(this).find( 'span' ).length ) { $(this).wrapInner( '<span></span>' ); } }); $('body').on('click.eddwlOpenModal', '.edd-add-to-wish-list', function (e) { $( '#edd-wl-modal-label' ).wrapInner( '<span></span>' ); }); } return { init : function() { menuToggle(); menuSearch(); footerHeight(); soliloquySliders(); initVideos(); initPurchaseForms(); initSectionTitles(); $(window).resize(function() { footerHeight(); soliloquySliders(); }); $(document).on( 'click', '.popup-trigger', function(e) { e.preventDefault(); Marketify.App.popup({ items : { src : $(this).attr( 'href' ), fixedContentPos: false, fixedBgPos: false, overflowY: 'scroll' } }); }); $( 'body' ).on( 'edd_gateway_loaded', function() { initSectionTitles(); }); $( '.edd_download.content-grid-download' ).attr( 'style', '' ); // sorting widget $( '.download-sorting input, .download-sorting select' ).change(function(){ $(this).closest( 'form' ).submit(); }); $( '.download-sorting span' ).click( function(e) { e.preventDefault(); $(this).prev().attr( 'checked', true ); $(this).closest( 'form' ).submit(); }); $( '.content-grid-download__entry-image' ).bind( 'ontouchstart', function(e) { $(this).toggleClass( 'hover' ); }); $( '.individual-testimonial .avatar' ).wrap( '<div class="avatar-wrap"></div>' ); function pagi() { $( '.edd_downloads_list' ).each(function() { var pagi = $(this).find( $( '#edd_download_pagination' ) ); pagi.insertAfter( '.edd_downloads_list' ); }); } pagi(); $( '.download-gallery__image' ).magnificPopup({ delegate: 'a', type: 'image', gallery: { enabled: true, navigateByImgClick: true, preload: [0,1] // Will preload 0 - before current, and 1 after the current image } }); }, popup : function( args ) { return $.magnificPopup.open( $.extend( args, { type : 'inline', overflowY : 'hidden', removalDelay : 250 } ) ); }, } } )(jQuery); jQuery(document).ready(function() { Marketify.App.init(); });
March 3, 2017 at 4:34 pm #94361In reply to: Search & Filter Pro failing to work for me
RossKeymasterYup perfect
Add this to your themes JS:
(function ( $ ) { "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ var grid; $(el).find($('.edd_download.content-grid-download')).attr('style', ''); grid = document.querySelector(el); salvattore['register_grid'](grid); }); }(jQuery));
Let me know that works ok, its working locally just fine 🙂
February 14, 2017 at 1:18 pm #90023In reply to: Filter by category doesn't work
AnonymousInactiveHi trevor,
yes, we are using WPML.
But it doesn’t affect the result if I filter by 1 category.
E.g. if I filter by edition „elements 01-2015“ I always get 5 posts, no matter what category I select.
https://elements.schiedel.com/en/?sfid=10323&_sft_ausgabe=elements-01-2015-enIf I deactivate WPML and filter by edition „elements 01-2015“ again, I also get the same 5 posts.
But I have more categories to select from (because I see all the categories from the different languages).Here’s the code of my template (search.php) that I use for filtering:
========================<?php /* ** search.php ** mk_build_main_wrapper : builds the main divisions that contains the content. Located in framework/helpers/global.php ** mk_get_view gets the parts of the pages, modules and components. Function located in framework/helpers/global.php */ get_header(); Mk_Static_Files::addAssets('mk_button'); Mk_Static_Files::addAssets('mk_audio'); Mk_Static_Files::addAssets('mk_swipe_slideshow'); #mk_build_main_wrapper( mk_get_view('templates', 'wp-search', true) ); #mk_build_main_wrapper( mk_get_view('global', 'shortcode-heading', true) ); $sc = '[mk_page_section bg_color="#000000" bg_position="center center" bg_stretch="true" min_height="" js_vertical_centered="true" padding_top="0" padding_bottom="0" visibility="hidden-sm" sidebar="sidebar-1"][vc_column][vc_column_text][searchandfilter id="9098"][/vc_column_text][/vc_column][/mk_page_section] [mk_page_section bg_position="center center" bg_stretch="true" min_height="280" js_vertical_centered="true" padding_top="0" padding_bottom="0" visibility="visible-sm" sidebar="sidebar-1"][vc_column][vc_column_text][searchandfilter id="9098"][/vc_column_text][/vc_column][/mk_page_section] [vc_row][vc_column][mk_padding_divider size="25"][mk_blog style="grid" column="2" image_size="full" offset="" transparent_border="true" disable_meta="false" excerpt_length="400" pagination_style="2" disable_lightbox="true" featured_post_align="left" item_id="1409321765-54008b2595021"][/vc_column][/vc_row][vc_row fullwidth="true" visibility="hidden-sm"][vc_column][/vc_column][/vc_row]'; $content = do_shortcode($sc); mk_build_main_wrapper($content); get_footer();
========================
Thanks in advance!
Bye
MarkusFebruary 3, 2017 at 6:21 pm #88017In reply to: Combobox text not showing in mobile
TrevorParticipantI cannot see any errant styles there. In the Search & Filter plugin main settings, maybe try Select2 instead of Chosen?
February 2, 2017 at 7:16 pm #87689In reply to: to possible? + Showing when filter is active
AnonymousInactiveI just noticed that the title of the topic was parsed out, it was supposed to say “select to ul possible?” so that might have made it a little confusing.
What I am hoping is to make it so that instead of the filter using the select elements and the code being:
<select name="input_name"><option value="1"><option value="2"><option>
It would render the drop downs as unordered lists so that they could be custom styled. like:
<ul name="input_name"><li>option 1</li><li>option 2</li></ul>
As for the second question, what I meant is so that when the form is submitted/changed by the user I want to append a new class to the filter/elements that shows that its active and remove it when the filter is just showing the default. Is there a specific hook I can use for when the form submits and has values vs when the form clears and returns to default.
February 2, 2017 at 7:00 pm #87684In reply to: to possible? + Showing when filter is active
TrevorParticipantI think this reply to a different thread might be applicable to this thread:
https://support.searchandfilter.com/forums/topic/split-form-output-single-field/#post-86065
However, I have seen some users style a list of checkboxes so that clicking the title opens and closes the list? I am not sure how they have done it, by custom CSS I should think, and maybe a bit of javascript. Most elements have unique classes and/or ID’s to target.
Or did I miss the point?
I have a feeling a lot more functionality like this will arrive in the next major update, V3.
February 2, 2017 at 4:49 pm #87632Topic: to possible? + Showing when filter is active
in forum Search & Filter Pro
AnonymousInactiveIs there a way for me to change the select/list options to render as a ul element for advanced styling? I want to style the drop downs similar to a faux dropdown like bootstrap does. Also is there a way to add a class/attribute to the filter when it is active/filtering and remove it when the filter is “empty”, like some specific event I can hook into with javascript?
February 2, 2017 at 7:56 am #87538In reply to: Filter showing "dots" overlayed on checkboxes
TrevorParticipantThis will be style added by your theme or another plugin. Use of the Inspector in your browser would show that this is the offending CSS from
visual-composer-theme-master.min.css
:.entry-content ul > li::before { content: '\2022'; font-size: 1.5em; position: absolute; left: 20px; line-height: 1.3; color: #557cbf; }
The simplest fix is to remove the content part with Custom CSS:
.searchandfilter .entry-content ul > li::before { content: '' !important; }
You might wish to read up on the use of the browser inspector by finding some guides or tutorials on Google (if there are any), as it is a useful tool.
January 28, 2017 at 3:49 pm #86340In reply to: Empty searchfield
RossKeymasterHi Michael
It depends where you look, Avada shows no results without a search string, WP default themes do show an archive style layout even if you remove the term from the URL.
The way avada does it is simply in the results template. They check to see if a search string has been found, and if, do the usual loop /
have_posts
etc, but not, show “none found” etc.We have a function for getting the search term too (amongst other search data) which you can use in your results templates:
Hope that makes sense?
Best
-
AuthorSearch Results
-
Search Results
-
Is there a way for me to change the select/list options to render as a ul element for advanced styling? I want to style the drop downs similar to a faux dropdown like bootstrap does. Also is there a way to add a class/attribute to the filter when it is active/filtering and remove it when the filter is “empty”, like some specific event I can hook into with javascript?