Jump to content

CFCBazar

New Members
  • Posts

    9
  • Joined

  • Last visited

CFCBazar's Achievements

Member

Member (2/5)

0

Reputation

  1. Ok, I guess this is it. To summarize: Wordpress does not deal with commercial content. Still waiting for an answer from AliPartnership. Thanks for the help guys!
  2. While I wait for a response from AliPartnership, here is what I found: 0. Search.php, I finally found this page. <?php get_template_part( 'templates/products' );?> 1. Searchform.php <form class="search" method="GET" action="<?php echo esc_url(home_url( '/' )) ?>"> <div class="input-group"> <input type="text" name="s" class="form-control" placeholder="<?php _e('i`m shopping for...', 'ali4'); ?>" value="<?php echo get_search_query() ?>"> <span class="input-group-btn"> <button class="btn btn-default" type="submit"> <span class="social-icon-search"></span> </button> </span> </div> </form> 2. I also need to change this line to work with "vk.com", instead of google+. <li> <a rel="nofollow" href="https://plus.google.com/share?url=<?php echo esc_url(home_url(add_query_arg(array()))); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600'); return false;" target="_blank"> <span class="social-icon-gplus-squared"></span> </a> </li> I tried replacing: https://plus.google.com/share?url= with http://vk.com/share.php?url= but it does not copy the link to the vk.com message. Thanks to everyone for the help so far, please bare a little more.
  3. True, but I don't belive it will happen.
  4. I have already posted this on Wordpress, but I think its a PHP problem. Even if they point out exactly where is the code, I will still need PHP to change it. I will wait until worpdress' response.
  5. I don't know how to describe it better, when you use the search box on the first page it should give the products according to relevance, not when you write "transistor" to not get transistors. I searched the code and found only this. There is no page "search.php" so the code is from "functions.php". I already gave the exact code in the previous post.
  6. The products shown are completely off topic´╗┐, you have to be very accurate to get what you need, if you are too accurate of course, you will get nothing. Please visit "http://www.beta.cfcbazar.com" and check.
  7. $text['search'] = __('Search Results for: %s', 'ali4', get_search_query()); --------------------------------------------------------------------------------- } elseif (is_search()) { echo $before . sprintf($text['search'], get_search_query()) . $after; } elseif (is_day()) { echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter; echo sprintf($link, get_month_link(get_the_time('Y'), get_the_time('m')), get_the_time('F')) . $delimiter;
  8. Thank you very much for the reply! This is the whole code, I hope it includes everything needed. Its from "functions.php" of wordpress. <?php include_once 'walkers/wp-bootstrap-navwalker-master/wp_bootstrap_navwalker.php'; include_once 'walkers/wp-bootstrap-comments/wp_bootstrap_comments.php'; include_once 'libs/customize.php'; /** * This File stared auto settings theme; */ include get_stylesheet_directory() . '/config/init.php'; remove_action('wp_head', 'wp_print_scripts'); remove_action('wp_head', 'wp_print_head_scripts', 9); remove_action('wp_head', 'wp_enqueue_scripts', 1); add_action('wp_footer', 'wp_print_scripts', 5); add_action('wp_footer', 'wp_enqueue_scripts', 5); add_action('wp_footer', 'wp_print_head_scripts', 5); //remove some meta at header remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file. remove_action( 'wp_head', 'index_rel_link' ); // index link remove_action( 'wp_head', 'wp_generator' ); // Display the XHTML generator that is generated on the wp_head hook, WP version function ali4_nl2br_content($content){ $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; } function ali4_get_content($post_id){ $post = get_post_field('post_content', $post_id); $post = get_extended($post); echo $post['main'] ; } function ali4_init_before(){ global $ali4; $ali4 = new ali4Options(); } add_action('init', 'ali4_init_before'); function ali4_script_assets() { wp_register_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '3.2'); wp_register_script( 'fotorama', plugins_url( '/aliplugin/js/fotorama.js' ), array('jquery'), '4.6.4' ); wp_register_script( 'slider', get_template_directory_uri() . '/js/jquery-ui.min.js', array('jquery'), '1.8.13'); wp_register_script( 'owl', get_template_directory_uri() . '/js/owl.carousel.min.js', array('jquery'), '1.0'); wp_register_script( 'ali4-index', get_template_directory_uri() . '/js/index.js', array('bootstrap', 'fotorama', 'slider', 'owl'), '1.0'); wp_enqueue_script( 'ali4-index'); } add_action( 'wp_enqueue_scripts', 'ali4_script_assets' ); function ali4_style_assets(){ $foo = array( 'bootstrap' => get_stylesheet_directory_uri() . '/css/bootstrap.min.css?ver=3.2', 'bootstrap-theme' => get_stylesheet_directory_uri() . '/css/bootstrap-theme.min.css?ver=3.2', 'fotorama' => plugins_url('/aliplugin/css/fotorama.css') . '?ver=4.6.4', 'fontello' => get_stylesheet_directory_uri() . '/css/fontello.css?ver=1.0', 'owl' => get_stylesheet_directory_uri() . '/css/owl.carousel.css?ver=1.0', 'owl-theme' => get_stylesheet_directory_uri() . '/css/owl.theme.css?ver=1.0', 'ali4-style' => get_stylesheet_directory_uri() . '/style.css?ver=1.0', ); if ( is_rtl() ){ $foo['rtl-css'] = get_stylesheet_directory_uri() . '/css/rtl.css?ver=1.0'; } foreach($foo as $key => $val) printf('<link id="%s" href="%s" rel="stylesheet" type="text/css"/>' . "\n", $key, $val); } add_action( 'wp_head', 'ali4_style_assets' ); function ali4_theme(){ add_theme_support('menus'); add_theme_support('post-thumbnails'); load_theme_textdomain('ali4', get_template_directory() . '/languages'); } add_action('after_setup_theme', 'ali4_theme'); function ali4_posts_process($post_type = 'post', $args = array(), $cat_id = 0){ if(!$post_type) { return false; } $params = array( 'paged' => max( 0, get_query_var('paged') ), 'post_status' => 'publish', 'post_type' => $post_type, ); if($cat_id) { $params['tax_query'] = array( array( 'taxonomy' => 'shopcategory', 'field' => 'id', 'terms' => $cat_id, )); } $params = array_merge($params, $args); query_posts($params); return true; } function ali4_notimage( $string ){ if($string !== '') { return $string; } return get_template_directory_uri() . '/images/image-not-available'; } function ali4_rating( $number = 0.0, $countReview ) { $number = floatval( $number ); $max = 5; $int = intval($number); $star = array(); for($i=0; $i < $int; $i++) { $star[] = 'full'; } if( $int != $number ) $star[] = 'half'; $empty = $max - count($star); for($i=0; $i < $empty; $i++) { $star[] = 'none'; } $star = implode('"></span><span class="rate rate-', $star); $ret = ($countReview == 0) ? '<span class="rate rate-' . $star . '"></span><span class="review"></span>' : '<span class="rate rate-' . $star . '"></span><span class="review"> ' . $countReview . '</span>'; return $ret; } function ali4_rating_percentage($number = 0.0, $max = 5.0){ $number = floatval($number); $max = floatval($max); return ($number*100)/$max; } function ali4_posts_clauses( $pieces ){ global $wp_query, $wpdb; if( ali4_is_tax($wp_query) ) { $min = ae_get_default_price(abs(floatval(ali4_is_var_in_get('pmin', true))), false); $max = ae_get_default_price(abs(floatval(ali4_is_var_in_get('pmax', true))), false); $orderby = ali4_is_var_in_get( 'orderby', false, false, array('string', ali4_sort_array(false, true), false) ); $order = ali4_is_var_in_get('order', false, false, array('string', array('ASC', 'DESC'), false)); $pieces['join'] .= ", `{$wpdb->prefix}ae_products` pr"; $pieces['fields'] .= ', pr.price, pr.salePrice, pr.promotionVolume, pr.evaluateScore, pr.lotNum, pr.packageType, pr.storeName, pr.imageUrl, pr.timeleft, pr.quantity, pr.summary, pr.keywords'; if($min > -1 || $max > -1 || $orderby == 'price') { $pieces['join'] .= ", (SELECT id, CAST( SUBSTRING_INDEX( IF( salePrice <> '', salePrice, price), '$', -1 ) AS DECIMAL( 10, 2 ) ) AS pp FROM `{$wpdb->prefix}ae_products` ) AS pu"; $pieces['where'] = "AND pu.id = pr.id " . $pieces['where'] . " AND {$wpdb->posts}.ID = pr.post_id"; if($min < $max) { $pieces['where'] .= " AND pu.pp <= '{$max}'"; $pieces['where'] .= " AND pu.pp >= '{$min}'"; } elseif($min) { $pieces['where'] .= " AND pu.pp >= '{$min}'"; } elseif($max) { $pieces['where'] .= " AND pu.pp <= '{$max}'"; } } else { $pieces['where'] .= " AND {$wpdb->posts}.ID = pr.post_id"; } if($orderby == 'price') { $pieces['orderby'] = "pu.pp " . $order; } elseif($orderby == 'promotionVolume') { $pieces['orderby'] = "CAST(promotionVolume as UNSIGNED) " . $order; } elseif($orderby == 'evaluateScore') { $pieces['orderby'] = "evaluateScore " . $order; } elseif(!$orderby) { // $pieces['orderby'] = "rand() " . $order; $pieces['orderby'] = ""; } } return $pieces; } if( !is_admin() ){ add_filter( 'posts_clauses', 'ali4_posts_clauses' ); } function ali4_is_tax($query){ if( is_tax('shopcategory') && isset($query->query_vars['shopcategory']) || (isset($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'products') || (is_search() && !isset($query->query_vars['post_type'])) ) { return true; } return false; } /** * This function do validate data */ function ali4_is_var_in_get($name, $var = false, $default = false, $valid = array()){ $error = false; if(isset($_GET[$name])) { if(count($valid)) { if($valid[0] == 'number' && ali4_valid_number($_GET[$name], $valid[1])) { $error = true; } elseif($valid[0] == 'string' && ali4_valid_string($_GET[$name], $valid[1])) { $error = true; } } else { $error = true; } if($var === false) { if($error) { return $_GET[$name]; } else { return $valid[2]; } } elseif($var == $_GET[$name]) { if($error) { return $_GET[$name]; } else { return $valid[2]; } } } return $default; } function ali4_sort_array($first = false, $key = false){ $arr = array( 'promotionVolume' => array( 'name' => __('Best sellers', 'ali4'), 'sort' => false, ), 'latest' => array( 'name' => __('Latest', 'ali4'), 'sort' => false, ), 'evaluateScore' => array( 'name' => __('Ratings', 'ali4'), 'sort' => true, ), 'price' => array( 'name' => __('Price', 'ali4'), 'sort' => true, ), ); if($key) { $arr = array_keys($arr); } if($first) { $arr = current($arr); } return $arr; } function ali4_image_get_alt($images, $once = false){ if(!is_array($images)) { return array(); } $result = array(); foreach($images as $val) { $alta = explode('/', $val); $alta = $alta[count($alta)-1]; $alt = str_replace('-', ' ', substr($alta, 0, strpos($alta, '.'))); $result[] = array( 'url' => $val, 'alt' => $alt ); } if($once && count($result)) { $result = array_shift($result); } return $result; } function ali4_showSKU( $sku ) { foreach ( $sku as $k => $v ) { if ( !empty( $v['params'] ) ) { $items = ''; foreach ( $v['params'] as $key => $val ) { if ( !empty( $val ) ) { if ( ae_is_url( $val ) ) $items .= sprintf( '<span class="meta-item-img sku-set"><img src="%1$s" class="img-responsive"></span>', $val ); else $items .= sprintf( '<span class="meta-item sku-set">%1$s</span>', $val ); } } if ( $items != '' ) printf( '<dl class="item-sku"> <dt>%1$s</dt><dd>%2$s</dd> </dl>', $v[ 'title' ], $items ); } } } function ali4_breadcrumbs(){ $text['home'] = __('Home', 'ali4'); $text['category'] = __('Archive article "%s"', 'ali4', get_the_date()); $text['search'] = __('Search Results for: %s', 'ali4', get_search_query()); $text['tag'] = __('Tag Archives: %s', 'ali4', single_tag_title('', false)); $text['author'] = __('All posts by %s', 'ali4', get_the_author()); $text['404'] = __('Not Found', 'ali4'); $show_current = 1; $show_on_home = 0; $show_home_link = 1; $show_title = 1; $delimiter = ' &rsaquo; '; $before = '<span class="current">'; $after = '</span>'; global $post; $home_link = home_url('/'); $link_before = '<span typeof="v:Breadcrumb">'; $link_after = '</span>'; $link_attr = ' rel="v:url" property="v:title"'; $link = $link_before . '<a' . $link_attr . ' href="%1$s">%2$s</a>' . $link_after; $parent_id = $parent_id_2 = (isset($post->post_parent)) ? $post->post_parent: null; $frontpage_id = get_option('page_on_front'); if (is_home() || is_front_page()) { if ($show_on_home == 1) { echo '<div class="breadcrumbs"><a href="' . $home_link . '">' . $text['home'] . '</a></div>'; } } else { echo '<div class="breadcrumbs" xmlns:v="http://rdf.data-vocabulary.org/#">'; if ($show_home_link == 1) { echo '<a href="' . $home_link . '" rel="v:url" property="v:title">' . $text['home'] . '</a>'; if ($frontpage_id == 0 || $parent_id != $frontpage_id) { echo $delimiter; } } if (is_category()) { $this_cat = get_category(get_query_var('cat'), false); if ($this_cat->parent != 0) { $cats = get_category_parents($this_cat->parent, TRUE, $delimiter); if ($show_current == 0) $cats = preg_replace("#^(.+)$delimiter$#", "$1", $cats); $cats = str_replace('<a', $link_before . '<a' . $link_attr, $cats); $cats = str_replace('</a>', '</a>' . $link_after, $cats); if ($show_title == 0) $cats = preg_replace('/ title="(.*?)"/', '', $cats); echo $cats; } if ($show_current == 1) { echo $before . sprintf($text['category'], single_cat_title('', false)) . $after; } } elseif (is_search()) { echo $before . sprintf($text['search'], get_search_query()) . $after; } elseif (is_day()) { echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter; echo sprintf($link, get_month_link(get_the_time('Y'), get_the_time('m')), get_the_time('F')) . $delimiter; echo $before . get_the_time('d') . $after; } elseif (is_month()) { echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter; echo $before . get_the_time('F') . $after; } elseif (is_year()) { echo $before . get_the_time('Y') . $after; } elseif (is_single() && !is_attachment()) { if (get_post_type() != 'post') { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; $tax = (get_post_taxonomies()) ? current(get_post_taxonomies()) : 'post'; $terms = wp_get_post_terms($post->ID, $tax); printf($link, $home_link . $slug['slug'] . '/', $post_type->labels->name); echo $delimiter; if($terms) { foreach($terms as $term) { printf($link, esc_url($home_link . $tax . '/' . $term->slug), $term->name); echo $delimiter; } } if ($show_current == 1) { echo $before . get_the_title() . $after; } } else { $cat = get_the_category(); $cat = $cat[0]; $cats = get_category_parents($cat, TRUE, $delimiter); if ($show_current == 0) { $cats = preg_replace("#^(.+)$delimiter$#", "$1", $cats); } $cats = str_replace('<a', $link_before . '<a' . $link_attr, $cats); $cats = str_replace('</a>', '</a>' . $link_after, $cats); if ($show_title == 0) { $cats = preg_replace('/ title="(.*?)"/', '', $cats); } echo $cats; if ($show_current == 1) { echo $before . get_the_title() . $after; } } } elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) { $post_type = get_post_type_object(get_post_type()); $terms = ''; if(isset($post->ID)) { $terms = get_the_terms($post->ID, get_query_var( 'taxonomy' )); } $term_p = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); if($term_p && $post_type) { printf($link, esc_url($home_link . $post_type->rewrite['slug']), $post_type->labels->name); echo $delimiter; } if($term_p && $term_p->parent) { if($terms) { $last_term = array_pop($terms); foreach($terms as $term) { printf($link, esc_url($home_link . get_query_var( 'taxonomy' ) . '/' . $term->slug), $term->name); echo $delimiter; } echo $before . $last_term->name . $after; } elseif($post_type) { echo $before . $post_type->labels->name . $after; } } elseif($term_p) { echo $before . $term_p->name . $after; } elseif($post_type) { echo $before . $post_type->labels->name . $after; } } elseif (is_attachment()) { $parent = get_post($parent_id); $cat = get_the_category($parent->ID); $cat = $cat[0]; if ($cat) { $cats = get_category_parents($cat, TRUE, $delimiter); $cats = str_replace('<a', $link_before . '<a' . $link_attr, $cats); $cats = str_replace('</a>', '</a>' . $link_after, $cats); if ($show_title == 0) { $cats = preg_replace('/ title="(.*?)"/', '', $cats); } echo $cats; } printf($link, get_permalink($parent), $parent->post_title); if ($show_current == 1) { echo $delimiter . $before . get_the_title() . $after; } } elseif (is_page() && !$parent_id) { if ($show_current == 1) { echo $before . get_the_title() . $after; } } elseif (is_page() && $parent_id) { if ($parent_id != $frontpage_id) { $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); if ($parent_id != $frontpage_id) { $breadcrumbs[] = sprintf($link, get_permalink($page->ID), get_the_title($page->ID)); } $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); for ($i = 0; $i < count($breadcrumbs); $i++) { echo $breadcrumbs[$i]; if ($i != count($breadcrumbs) - 1) { echo $delimiter; } } } if ($show_current == 1) { if ($show_home_link == 1 || ($parent_id_2 != 0 && $parent_id_2 != $frontpage_id)) { echo $delimiter; } echo $before . get_the_title() . $after; } } elseif (is_tag()) { echo $before . sprintf($text['tag'], single_tag_title('', false)) . $after; } elseif (is_author()) { global $author; $userdata = get_userdata($author); echo $before . sprintf($text['author'], $userdata->display_name) . $after; } elseif (is_404()) { echo $before . $text['404'] . $after; } elseif (has_post_format() && !is_singular()) { echo get_post_format_string(get_post_format()); } if (get_query_var('paged') > 1) { echo ' (' . __('Page', 'ali4') . ' ' . get_query_var('paged') . ')'; } echo '</div><!-- .breadcrumbs -->'; } } function ali4_get_term_ids($flug = false){ $ids = ali4_is_var_in_get('ids', true); if(!empty($ids)) { $ids = explode('-', $ids); } if(is_array($ids) && count($ids) && $flug) { $ids = current($ids); } return $ids; } function ali4_categories_menu($id = 0, $tax = 'shopcategory'){ $terms = get_terms($tax, array('parent' => $id)); $categories_menu = array(); if( count($terms) ) { foreach( $terms as $term ) { $categories_menu[] = array( 'id' => $term->term_id, 'link' => get_term_link( $term, $tax ), 'name' => $term->name, 'count' => $term->count, ); } } return $categories_menu; } function ali4_get_to_string(array $var = array()){ return (count($_GET) || count($var)) ? '?' . http_build_query(array_merge($_GET, $var)) : ''; } function ali4_paging_nav(){ global $wp_query; $posts_per_page = (isset($wp_query->query_vars['posts_per_page']) && intval($wp_query->query_vars['posts_per_page'])) ? $wp_query->query_vars['posts_per_page'] : intval(get_option('posts_per_page')); $big = 999999999; $paged = max( 1, get_query_var('paged') ); $count = $wp_query->found_posts; $total = ceil($count / $posts_per_page); $links = paginate_links(array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '/page/%#%', 'total' => $total, 'current' => $paged, 'type' => 'array', 'prev_text' => '&laquo;', 'next_text' => '&raquo;' )); $pagination = array(); if($links) { foreach($links as $link) { $pagination[] = array( 'active' => ali4_search_current($link), 'link' => $link, ); } } if(count($pagination)) { echo '<div class="pagination-block"><ul class="pagination" role="navigation">'; foreach($pagination as $link) { $class = ''; if( $link['active'] ) { $class=' class="active" '; } echo '<li'.$class.'>'.$link['link'].'</li>'; } echo '</ul></div>'; } } function ali4_search_current( $string ){ if(preg_match('/(current)/', $string)) { return true; } return false; } function ali4_valid_string($str, $is = array()){ if(!count($is)) { return false; } if(in_array($str, $is)) { return true; } return false; } function ali4_comment_form($args = array(), $post_id = null){ if (null === $post_id) { $post_id = get_the_ID(); } else { $id = $post_id; } $commenter = wp_get_current_commenter(); $user = wp_get_current_user(); $user_identity = $user->exists() ? $user->display_name : ''; $args = wp_parse_args($args); if (!isset($args['format'])) { $args['format'] = current_theme_supports('html5', 'comment-form') ? 'html5' : 'xhtml'; } $req = get_option('require_name_email'); $aria_req = ($req ? " aria-required='true'" : ''); $html5 = 'html5' === $args['format']; $fields = array( 'author' => '<p class="comment-form-author">' . '<label for="author">' . __('Name', 'ali4') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . __('Email', 'ali4') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<input id="email" name="email" ' . ($html5 ? 'type="email"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></p>', 'url' => '<p class="comment-form-url"><label for="url">' . __('Website', 'ali4') . '</label> ' . '<input id="url" name="url" ' . ($html5 ? 'type="url"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></p>', ); $required_text = sprintf(' ' . __('Required fields are marked %s', 'ali4'), '<span class="required">*</span>'); $fields = apply_filters('comment_form_default_fields', $fields); $defaults = array( 'fields' => $fields, 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Comment', 'ali4') . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'ali4'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'ali4'), get_edit_user_link(), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '<p class="comment-notes">' . __('Your email address will not be published.', 'ali4') . ($req ? $required_text : '') . '</p>', 'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf(__('You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s', 'ali4'), ' <code>' . allowed_tags() . '</code>') . '</p>', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __('Leave a Reply', 'ali4'), 'title_reply_to' => __('Leave a Reply to %s', 'ali4'), 'cancel_reply_link' => __('Cancel reply', 'ali4'), 'label_submit' => __('Post Comment', 'ali4'), 'format' => 'xhtml', ); $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults)); include get_template_directory() . '/templates/comments.php'; } function ali4_products_filter($query){ if(ali4_is_tax($query)) { if( is_search() ){ $query->set('post_type', 'products'); } $ids = ali4_get_term_ids(); if(count($ids) && !isset($query->query_vars['pre_process'])) { if(is_array($ids) && count($ids)) { $query->set('tax_query',array( array( 'taxonomy' => 'shopcategory', 'field' => 'id', 'terms' => $ids ), )); } } } return $query; } if( !is_admin() ) { add_action('pre_get_posts', 'ali4_products_filter'); } function the_term_link($id, $taxonomy = 'shopcategory'){ $term_link = get_term_link( intval($id), $taxonomy ); if( !is_wp_error( $term_link ) ) echo $term_link; } function the_term_title($id, $taxonomy = 'shopcategory'){ $term = get_term_by('id', intval($id), $taxonomy); if($term) echo $term->name; } function isMobile(){ return wp_is_mobile(); } /** * The title meta tag to page */ function ali4_title(){ global $page, $paged; wp_title( '|', true, 'right' ); $site_name = get_bloginfo( 'name' ); if ( $site_name ) echo " $site_name"; if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s', 'theme' ), max( $paged, $page ) ); } function ali4_description(){ global $page, $paged, $wp, $post, $ali4; $tPage = ''; $description = ''; if ( $paged >= 2 || $page >= 2 ) { $tPage = ' - ' . sprintf( __( 'Page %s', 'ali4' ), max( $paged, $page ) ); } if ( is_home() ) { $description = $ali4->Description; echo $description . $tPage; return true; } if ( is_single() && get_post_type() == 'products' ) { $description = $post->summary; if ( !$description ) { $nameProduct = single_post_title( '', false ); $description = __( 'Buy', 'ali4' ) . ' ' . $nameProduct . ' ' . __( 'at', 'ali4' ) . ' ' . $_SERVER["SERVER_NAME"] . '! ' . __( 'Free shipping to 185 countries. 45 days money back guarantee.', 'ali4' ); } echo $description . $tPage; return; } echo $description . $tPage; return; } function ali4_keywords(){ global $post, $ali4; $keywords = ''; if ( is_home() ) { echo $ali4->Keywords; return true; } if ( is_single() && get_post_type() == 'products' ) { $keywords = $post->keywords; if (!$keywords) { $nameProduct = single_post_title( '', false ); $key[] = $nameProduct . ' ' . __( 'online', 'ali4' ); $key[] = __( 'buy', 'ali4' ) . ' ' . $nameProduct; $key[] = $nameProduct; echo implode( ',', $key ); return true; } } } function ali4_tree_categories() { $terms = get_terms('shopcategory'); if( count($terms) ) { $alphabet = array(); foreach( $terms as $term ) { $first_letter = ali4_substr(strtoupper($term->name), 0, 1); $alphabet[$first_letter][] = array( 'link' => get_term_link( $term, 'shopcategory' ), 'name' => $term->name, 'count' => $term->count, ); } $i = 0; $max = count($alphabet); $point = ceil($max/3); echo '<div class="row">'; foreach($alphabet as $letter => $cats) { $i++; if($i == 1) echo '<div class="col-sm-20">'; $out = ''; foreach($cats as $key => $cat) { $out .= sprintf('<li><a href="%1$s" title="More about %2$s">%2$s</a><span>(%3$s)</span></li>', $cat['link'], $cat['name'], $cat['count'] ); } printf('<p><strong>%1$s</strong></p><ul>%2$s</ul>', $letter, $out); if( $i == $point ) { $i = 0; echo '</div>'; } } if( $i != 0 ) echo '</div>'; echo '</div>'; } } function ali4_trunc_text( $msg, $limit, $end = " ..." ){ if( mb_strlen($msg) <= $limit ) return $msg; if( mb_strlen($end) >= $limit ) $end = ''; $msg = trim(ali4_substr( $msg, 0, $limit - mb_strlen($end) )); return $msg . $end; } function ali4_substr( $string, $start, $end = false ) { preg_match_all("/./su", $string , $matches); if( $end ) return join( "", array_slice($matches[0], $start, $end) ); return join( "", array_slice($matches[0],$start) ); } The whole
  9. Hi guys! I want to improve the search function of a wordpress site with AliPlugin. The products shown are completely off topic, you have to be very accurate to get what you need, if you are too accurate of course, you will get nothing. The site is: http://www.beta.cfcbazar.com Its the site for testing. Can anyone help me please?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.