Advertisement:

Author Topic: [SOLVED]help putting number of ads next to category name  (Read 404 times)

joecoolll

  • Jr. Member
  • **
  • Posts: 86
[SOLVED]help putting number of ads next to category name
« on: July 26, 2018, 11:59:07 pm »
How would i put the amount of ads next to the cat names please ?

i use shopclass theme


thank you

« Last Edit: July 27, 2018, 02:52:18 am by joecoolll »

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: help putting number of ads next to category name
« Reply #1 on: July 27, 2018, 12:59:26 am »
CORRECTED

For Bender based themes:

In functions.php of your theme, there should be a function with a name like this THEMENAME_draw_category_list(). Next to osc_category_name() in that function (which displays name), add  osc_category_total_items() to show count of items.

Regards.
« Last Edit: July 27, 2018, 02:38:36 am by patrickFromCroatia »

joecoolll

  • Jr. Member
  • **
  • Posts: 86
Re: help putting number of ads next to category name
« Reply #2 on: July 27, 2018, 01:44:13 am »
i don't see it patrick


Code: [Select]
<?php
//error_reporting ( E_ALL );
//ini_set ( "display_errors" , 1 );
$info = WebThemes::newInstance()->loadThemeInfo( 'shopclass' );
define( 'SHOPCLASS_PATH' , dirname( __FILE__ ) );
define( 'TFC_VER' , $info[ 'version' ] );
// Include tfc cache class
require_once 'includes/cacheModal/tfcAbstractCache.php';
require_once 'includes/cacheModal/tfcCache.php';

/**
 * New flashmessage function derived from official function just changed styling to support our theme
 *
 * @param string $section
 * @param string $class
 * @param string $id
 */
function tfc_show_flash_message( $section = 'pubMessages' , $class = "flashmessage" , $id = "flashmessage" ) {
$messages = Session::newInstance()->_getMessage( $section );
if ( is_array( $messages ) ) {

foreach ( $messages as $message ) {
if ( isset( $message[ 'msg' ] ) && $message[ 'msg' ] != '' ) {
echo '<div id="' . $id . '" class="' . strtolower( $class ) . '-' . $message[ 'type' ] . ' alert alert-dismissible site-alert fade in">';
echo ' <button type="button" class="close" data-dismiss="alert" aria-label="Close">';
echo ' <span aria-hidden="true">&times;</span>';
echo ' </button>';
echo '<div class="text-center">' . osc_apply_filter( 'flash_message_text' , $message[ 'msg' ] ) . '</div>';
echo '</div>';
} elseif ( $message != '' ) {
echo '<div id="' . $id . '" class="site-alert alert-primary alert alert-dismissible fade in" >';
echo ' <button type="button" class="close" data-dismiss="alert" aria-label="Close">';
echo ' <span aria-hidden="true">&times;</span>';
echo ' </button>';
echo '<div class="text-center">' . osc_apply_filter( 'flash_message_text' , $message ) . '</div>';
echo '</div>';
}
}
}
Session::newInstance()->_dropMessage( $section );
}


/**
 * Function to return Shopclass theme path or require given file
 *
 * @param string $file
 *
 * @return string
 */
function tfc_path( $file = '' ) {
if ( ! empty( $file ) ) {
osc_current_web_theme_path( $file );
} else {
return SHOPCLASS_PATH . DIRECTORY_SEPARATOR;
}
}

if ( ! function_exists( 'logo_header' ) ) {
/**
 * @return string
 */
function logo_header() {
$html = '<img border="0" alt="' . osc_page_title() . '" src="' . osc_current_web_theme_url( 'images/logo.jpg' ) . '" />';
if ( file_exists( WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg" ) ) {
return $html;
} else if ( tfc_getPref( 'default_logo' ) && ( file_exists( WebThemes::newInstance()->getCurrentThemePath() . "images/default-logo.jpg" ) ) ) {
return '<img border="0" alt="' . osc_page_title() . '" src="' . osc_current_web_theme_url( 'images/default-logo.jpg' ) . '" />';
} else {
return osc_page_title();
}
}
}
// Include Shopclass Dashboard Function File
require 'includes/class/tfcAdminDashboard.php';
require 'includes/class/tfcAdminFormRegister.php';

// Inclue Shopclass Files Class;
require 'includes/class/tfcFilesClass.php';

// Include Sphinx Search Functions
if ( defined( 'SPHINX_SEARCH' ) ) {
require_once 'includes/sphinx/SphinxQL.php';
require_once 'includes/sphinx/SphinxQLClient.php';
require_once 'includes/sphinx/SphinxQLQuery.php';
require_once 'includes/sphinx/SphSearch.php';
require_once 'includes/sphinx/CWebSphSearch.php';
}
//Require image class
require_once 'includes/class/tfcImageManager.php';

// Include Custom Breadcrumb Class
require_once 'includes/class/tfcBreadcrumb.php';

// Include custom form model
require_once 'includes/frm/tfcGenForm.php';
require_once 'includes/frm/tfcItemForm.php';
require_once 'includes/frm/tfcform.php';
require_once 'includes/frm/tfcContactForm.php';

// include theme actions processing file
require_once 'includes/actions.php';

// Include pagination Classes
require_once 'includes/class/tfcPagination.php';

// SEO Functions
require_once 'includes/seo-extra.php';

// Sitemap Functions
require_once 'includes/sitemap-function.php';

// Core Functions
require_once 'includes/core-functions.php';

// Custom Functions
tfc_path( 'includes/custom-functions.php' );

// Script Enqueue functions
require_once 'includes/tfc.script.enqueue.php';

// Script/Style Loading functions
require_once 'includes/tfcScript.php';

// Spam remover, security functions
require_once 'includes/class/tfcStopForumSpam.php';
require_once 'includes/class/tfcSpamSecurity.php';

// Duplicate Checker Class
require_once 'includes/class/tfcDuplicateItem.php';

// Related Ads functions
require_once 'includes/related-ads.php';

// Meta Functions
require_once 'includes/meta-function.php';

// Favourite Functions
require_once 'includes/class/tfcFavouriteItem.php';

// Voting plugin helper Functions
if ( class_exists( 'ModelVoting' ) ) {
require_once 'includes/voting/tfcvoting.php';
}

// User Avatar Functions
require_once 'includes/class/tfcUserAvatar.php';

// SocialLogin Functions
require_once 'includes/SocialLogin/tfcSocialLoginClass.php';
require_once 'includes/SocialLogin/tfc_socialData.php';
// AdLoops Class
require_once 'includes/class/tfcAdsLoop.php';
//Admin Forms
if (OC_ADMIN) {
require_once 'admin/adminForms.php';
}
osc_run_hook( 'shopclass_admin_settings' );

// install update options
if ( ! function_exists( 'shopclass_theme_update' ) ) {
/**
 * Run function after theme update
 */
function shopclass_theme_update() {
//theme settings

tfc_seo_create_table();
tfc_sphinx_create_table();
tfc_favourite_create_table();
tfc_user_avatar_table();
osc_set_preference( 'version' , TFC_VER , 'shopclass_theme' );
osc_reset_preferences();

}
}


if ( ! function_exists( 'shopclass_theme_install' ) ) {
/**
 * Run function after theme install
 */
function shopclass_theme_install() {
//theme settings
if ( ! ( osc_get_preference( 'keyword_placeholder' , 'shopclass_theme' ) ) ) {
osc_set_preference( 'keyword_placeholder' , __( 'ie. PHP Programmer' , 'shopclass' ) , 'shopclass_theme' );
}
if ( ! ( osc_get_preference( 'header_logo_text' , 'shopclass_theme' ) ) ) {
osc_set_preference( 'header_logo_text' , 'ShopClass' , 'shopclass_theme' );
}
if ( ! ( osc_get_preference( 'header_logo_icon' , 'shopclass_theme' ) ) ) {
osc_set_preference( 'header_logo_icon' , 'fa-paper-plane' , 'shopclass_theme' );
}

osc_set_preference( 'facebook_fanpage' , 'osclass' , 'shopclass_theme' );
osc_set_preference( 'twitter_username' , 'osclass' , 'shopclass_theme' );

osc_set_preference( 'header_title_h1' , 'Welcome to Shopclass' , 'shopclass_theme' );
osc_set_preference( 'header_title_h3' , 'Post Ads For Mobile, Cars, Jobs, Real Estate, Services....' , 'shopclass_theme' );
osc_set_preference( 'header_search_title_h3' , 'We got you everything, Find Now ...' , 'shopclass_theme' );

osc_set_preference( 'footer_message' , 'We are your Free and most popular classified ad listing site. Become a free member and start listing your classified and Yellow pages ads within minutes. You can manage all ads from your personalized Dashboard.' , 'shopclass_theme' );

osc_set_preference( 'version' , TFC_VER , 'shopclass_theme' );
osc_set_preference( 'enable_caraousel' , true , 'shopclass_theme' );
osc_set_preference( 'enable_static_map' , true , 'shopclass_theme' );
osc_set_preference( 'footer_link' , true , 'shopclass_theme' );

//Sitemap Settings
osc_set_preference( 'sitemap_number' , 1000 , 'shopclass_theme' );

// Seo Options
osc_set_preference( 'enable_seo' , true , 'shopclass_theme' );
osc_set_preference( 'homepage_title' , 'Welcome to Free Classified website' , 'shopclass_theme' );
osc_set_preference( 'login_title' , 'Login in your Account' , 'shopclass_theme' );
osc_set_preference( 'register_title' , 'Create a new account' , 'shopclass_theme' );
osc_set_preference( 'publish_title' , 'Publish your listing' , 'shopclass_theme' );
osc_set_preference( 'contact_title' , 'Contact us' , 'shopclass_theme' );

//createTables

tfc_seo_create_table();
tfc_sphinx_create_table();
tfc_favourite_create_table();
tfc_user_avatar_table();

osc_reset_preferences();

}
}
$versionNew = strtr( $info[ 'version' ] , array ( '.' => '' ) );
$versionOld = strtr( osc_get_preference( 'version' , 'shopclass_theme' ) , array ( '.' => '' ) );

if ( ! ( osc_get_preference( 'version' , 'shopclass_theme' ) ) ) {
shopclass_theme_install();
osc_run_hook( 'shopclass_install' );
osc_add_flash_ok_message( __( 'Hey Welcome To Shopclass Theme, Please Checkout Our Dashboard Options' , 'shopclass' ) , 'admin' );
if (!file_exists(osc_uploads_path().'categorypics')){
if (is_writable(osc_uploads_path())){
tfcFilesClass::copyFolder(tfc_path().'assets/categorypics', osc_uploads_path().'categorypics');
}
else{
osc_add_flash_warning_message( __( 'Osclass upload directory is not writable. Category images function will not work.' , 'shopclass' ) , 'admin' );
}
}
if (!file_exists(osc_uploads_path().'shopclass_slider')){
if (is_writable(osc_uploads_path())){
tfcFilesClass::copyFolder(tfc_path().'assets/images/bk_image', osc_uploads_path().'shopclass_slider');
}
else{
osc_add_flash_warning_message( __( 'Osclass upload directory is not writable. Main Slider will not work properly.' , 'shopclass' ) , 'admin' );
}
}
} elseif ( $versionNew > $versionOld ) {
shopclass_theme_update();
osc_run_hook( 'shopclass_update' );
osc_add_flash_ok_message( __( 'Great You have updated Shopclass to latest version' , 'shopclass' ) , 'admin' );
if (!file_exists(osc_uploads_path().'categorypics')){
if (is_writable(osc_uploads_path())){
tfcFilesClass::copyFolder(tfc_path().'assets/categorypics', osc_uploads_path().'categorypics');
}
else{
osc_add_flash_warning_message( __( 'Osclass upload directory is not writable. Category images function will not work.' , 'shopclass' ) , 'admin' );
}
}
if (!file_exists(osc_uploads_path().'shopclass_slider')){
if (is_writable(osc_uploads_path())){
tfcFilesClass::copyFolder(tfc_path().'assets/images/bk-image', osc_uploads_path().'shopclass_slider');
}
else{
osc_add_flash_warning_message( __( 'Osclass upload directory is not writable. Main Slider will not work properly.' , 'shopclass' ) , 'admin' );
}
}
}

osc_run_hook( 'shopclass_loaded' );

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: help putting number of ads next to category name
« Reply #3 on: July 27, 2018, 02:11:29 am »
For ShopClass theme:

Open theme directory and the home_layout.
There you will find 3 files, according to the layout you use, edit one file.
Where you see "<?php echo osc_category_name(); ?>" add "<?php echo osc_category_total_items(); ?>".

Regards.
« Last Edit: July 27, 2018, 02:37:35 am by patrickFromCroatia »

joecoolll

  • Jr. Member
  • **
  • Posts: 86
Re: help putting number of ads next to category name
« Reply #4 on: July 27, 2018, 02:30:22 am »
ok thank you 

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: help putting number of ads next to category name
« Reply #5 on: July 27, 2018, 02:39:27 am »
Please add "[SOLVED]" to this and the other post title.

Regards.