The file had a serious problem, I fixed it. Please update
-
<?php
/**
* Classified Aditem Functions.
*
* Functions for aditem specific things.
*
* @author WenSolutions
* @category Core
* @package Classified/Functions
* @since 1.0.0
*/if ( ! defined( ‘ABSPATH’ ) ) {
exit; // Exit if accessed directly
}/**
* Main function for returning aditems, uses the WSC_Aditem_Factory class.
*
* @param mixed $the_aditem Post object or post ID of the aditem.
* @param array $args (default: array()) Contains all arguments to be used to get this aditem.
* @return WSC_Aditem
*/
function wsc_get_aditem( $the_aditem = false, $args = array() ) {
if ( ! did_action( ‘classified_init’ ) ) {
_doing_it_wrong( __FUNCTION__, __( ‘wsc_get_aditem should not be called before the classified_init action.’, ‘classified’ ), ‘2.5’ );
return false;
}
return WSC()->aditem_factory->get_aditem( $the_aditem, $args );
}/**
* Get the placeholder image URL for items etc.
*
* @access public
* @return string
*/
function wsc_placeholder_img_src() {
return apply_filters( ‘classified_placeholder_img_src’, WSC()->plugin_url() . ‘/assets/images/placeholder.png’ );
}/**
* Get the placeholder image.
*
* @access public
* @return string
*/
function wsc_placeholder_img( $size = ‘shop_thumbnail’ ) {
$dimensions = wsc_get_image_size( $size );return apply_filters(‘classified_placeholder_img’, ‘‘, $size, $dimensions );
}/**
* This will insert Single Product Views detail to classified_view_counter Table.
* @since 2.0.0
* @return Void
*/
function wsc_view_insert(){if( !is_main_query() )
return;if(!is_singular(‘aditem’))
{
return;
}$user_details = wp_get_current_user();
if( !empty( $user_details->roles ) && ‘administrator’ == $user_details->roles[0] )
return;global $post, $wpdb;
require_once( ‘class-wsc-user-agent.php’ );
$ua_info = new WSC_User_Agent();// require_once( ‘wsc-user-agent-functions.php’ );
// $ua_info = parse_user_agent();$table = $wpdb->base_prefix.’classified_view_counter’;
$current_date = date( ‘Y-m-d H:i:s’ );
$view_year = date( ‘Y’ );
$view_month = date( ‘m’ );
$view_day = date( ‘d’ );$view_week = date( ‘W’ );
$wpdb->insert(
$table,
array(
‘post_id’ => $post->ID,
‘ip_address’ => $_SERVER[‘REMOTE_ADDR’],
‘browser’ => $ua_info->browser(),
‘platform’ => $ua_info->platform(),
‘view_date’ => $current_date,
‘view_year’ => $view_year,
‘view_month’ => $view_month,
‘view_day’ => $view_day,
‘view_week’ => $view_week,
),
array(
‘%d’,
‘%s’,
‘%s’,
‘%s’,
‘%s’,
‘%s’,
‘%s’,
‘%s’,
‘%s’
)
);
}
/**
* Hook to insert
*/
add_action( ‘template_redirect’, ‘wsc_view_insert’ );function classified_get_view_count(){
global $post, $wpdb;
$table = $wpdb->base_prefix.’classified_view_counter’;
$total_views = $wpdb->get_var( “SELECT COUNT(*) as total_view FROM $table where post_id= $post->ID” );
return esc_attr( $total_views );
}// Fixed shop page current_page_parent class not showing
function add_parent_url_menu_class( $classes = array(), $item = false ) {
// Get current URL
$current_url = classified_current_url();
// Get homepage URL
$homepage_url = trailingslashit( get_bloginfo( ‘url’ ) );// Exclude 404 and homepage
if( is_404() or $item->url == $homepage_url )
return $classes;if ( get_post_type() == “additem” )
{
unset($classes[array_search(‘current_page_parent’,$classes)]);
if ( isset($item->url) )
if ( strstr( $current_url, $item->url) )
$classes[] = ‘current-menu-item’;
}return $classes;
}function classified_current_url() {
global $wp;
return trailingslashit( home_url(add_query_arg(array(),$wp->request)) ); //get current url
}
add_filter( ‘nav_menu_css_class’, ‘add_parent_url_menu_class’, 10, 3 );
- The topic ‘The file had a serious problem, I fixed it. Please update’ is closed to new replies.