Viewing 12 replies - 1 through 12 (of 12 total)
  • utilibre,

    probably your theme doesn’t have a registered sidebar. This is a kind of declaration in your main functions.php file’ s theme.
    You must see if there is something like this:

    `function zresponsive_widgets_init() {
    register_sidebar(
    array(
    ‘name’ => ‘Sidebar’,
    ‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</aside><!– .widget –>’,
    ‘before_title’ => ‘<h3 class=”widget-title”>’,
    ‘after_title’ => ‘</h3>’
    )
    );
    register_sidebar(
    array(
    ‘name’ => ‘Footer’,
    ‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</aside><!– .widget –>’,
    ‘before_title’ => ‘<h3 class=”widget-title”>’,
    ‘after_title’ => ‘</h3>’
    )
    );
    }`

    If not, post your functions.php code here.

    Thread Starter utilibre

    (@utilibre)

    @zsolemolina, you might be right! I cannot find the exact code you give but here is my functions.php

    [please mark any posted code – http://codex.wordpress.org/Forum_Welcome#Posting_Code – or even better, use the pastebin]

    <?php
    
    define('THEME_ICON', get_template_directory(). 'images/icon-theme.png');
    
    // WordPress plugin functions
    require_once(ABSPATH . 'wp-admin/includes/plugin.php');
    
    // Core startup
    require_once('core/core-init.php');
    
    // Load Language Text Domain
    add_action('after_setup_theme', 'core_load_theme_textdomain');
    function core_load_theme_textdomain(){
    	load_theme_textdomain( THEME_SLUG, get_template_directory() . '/languages' );
    }
    
    // Theme options
    require_once('includes/theme-options.php');
    
    // Register sliders
    require_once('includes/slider-nivo.php');
    require_once('includes/slider-latest.php');
    require_once('includes/slider-layer.php');
    
    // Register layouts
    require_once('includes/layouts.php');
    
    // Customizer settings
    require_once('includes/customization.php');
    
    // WooCommerce integration
    if (is_plugin_active('woocommerce/woocommerce.php'))
    	require_once('includes/woocommerce.php');
    
    // Theme widgets
    //
    require_once('widgets/categories.php');
    require_once('widgets/adwidget.php');
    require_once('widgets/postwidget.php');
    require_once('widgets/tabbedwidget.php');
    
    function theme_register_widgets() {
    	if (!is_blog_installed())
    		return;
    
    	register_widget('TD_Widget_Categories');
    	register_widget('td_adWidget');
    	register_widget('td_postWidget');
    	register_widget('td_tabbedWidget');
    
    }
    add_action('widgets_init', 'theme_register_widgets');
    
    // Theme styles and scripts
    //
    function theme_enqueue_scripts() {
    	wp_enqueue_script('jquery');
    	wp_enqueue_script('jquery-ui-core');
    	wp_enqueue_script('jquery-effects-core');
    
    	// Theme
    	wp_enqueue_script('theme-script', THEME_URI. '/js/theme.js', array('jquery', 'jquery-ui-core'), '', true);
    
    	// PrettyPhoto lightbox
    	wp_enqueue_style('prettyphoto-style', CSS_URI. '/prettyPhoto.css');
    	wp_enqueue_script('prettyphoto-script', THEME_URI. '/js/jquery.prettyPhoto.js', array('jquery'), '', true);
    
    	// Mobile Menu
    	wp_enqueue_script('mobileMenu', THEME_URI. '/js/jquery.mobilemenu.js', array('jquery'), '', true);
    
    	// Thumbnail CA Slider
    	wp_enqueue_script('tdcarousel', THEME_URI. '/js/jquery.carousel.min.js', array('jquery'), '', true);
    
    	// Element resize events
    	wp_enqueue_script('jquery-resize', THEME_URI. '/js/jquery.ba-resize.min.js', array('jquery'), '', true);	
    
    	// Tabber Tabs and Widget CSS
    	wp_enqueue_style('widgets', THEME_URI. '/widgets/widgets.css');
    	wp_enqueue_script('tabbertabs', THEME_URI . '/widgets/js/tabber.js');
    
    	// Comment replies
    	if (is_singular() && get_option('thread_comments'))
    		wp_enqueue_script('comment-reply');
    
    	// CSS3 media query support for older IE versions
    	if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE'))
    		wp_enqueue_script('css3-mediaqueries', THEME_URI. '/js/css3-mediaqueries.js', '', '', true);
    }
    add_action('wp_enqueue_scripts', 'theme_enqueue_scripts');
    
    // Theme menus
    //
    register_nav_menus(array(
    	'theme_main' => 'Main menu',
    	'theme_footer' => 'Footer menu')
    );
    
    $theme_menus['main'] = array(
    	'theme_location' => 'theme_main',
    	'depth' => 3,
    	'menu_class' => '',
    	'menu_id' => 'theme-menu-main',
    	'container' => false,
    	'fallback_cb' => ''
    );
    
    $theme_menus['footer'] = array(
    	'theme_location' => 'theme_footer',
    	'depth' => 1,
    	'menu_class' => '',
    	'menu_id' => '',
    	'container' => false,
    	'fallback_cb' => ''
    );
    
    // Sociables
    //
    core_sociables_register('twitter', 'Twitter', 'http://twitter.com/', THEME_URI. '/images/sociables/sociables-twitter.png', THEME_URI. '/images/sociables/sociables-twitter-hover.png');
    core_sociables_register('facebook', 'Facebook', 'http://facebook.com/', THEME_URI. '/images/sociables/sociables-facebook.png', THEME_URI. '/images/sociables/sociables-facebook-hover.png');
    core_sociables_register('linkedin', 'LinkedIn', 'http://linkedin.com/', THEME_URI. '/images/sociables/sociables-linkedin.png', THEME_URI. '/images/sociables/sociables-linkedin-hover.png');
    core_sociables_register('youtube', 'YouTube', 'http://youtube.com/', THEME_URI. '/images/sociables/sociables-youtube.png', THEME_URI. '/images/sociables/sociables-youtube-hover.png');
    core_sociables_register('googleplus', 'Google+', 'http://plus.google.com/', THEME_URI. '/images/sociables/sociables-googleplus.png', THEME_URI. '/images/sociables/sociables-googleplus-hover.png');
    core_sociables_register('custom1', 'Custom 1', '', '', '', true);
    core_sociables_register('custom2', 'Custom 2', '', '', '', true);
    core_sociables_register('custom3', 'Custom 3', '', '', '', true);
    core_sociables_register('custom4', 'Custom 4', '', '', '', true);
    
    // Register post\page option sections
    // Post\page option for themes
    //
    
    $theme_post_options = new CoreOptionHandler(THEME_SLUG . '-post-options', THEME_NAME . ' options', array('post', 'page'));
    core_options_handler_register($theme_post_options);
    
    require_once('includes/post-options.php');
    
    // SEO Basic
    //
    core_seo_register_spot('meta', __('Meta Title, Description and Keywords', THEME_SLUG));
    
    // Advertisement spots
    //
    core_ads_register_spot('header', __('Header', THEME_SLUG));
    core_ads_register_spot('content_before', __('Before content', THEME_SLUG));
    core_ads_register_spot('content_after', __('After content', THEME_SLUG));
    
    function theme_ad_before() {
    	echo core_ads_get('content_before');
    }
    add_action('core_before_template', 'theme_ad_before', 20);
    
    function theme_ad_after() {
    	echo core_ads_get('content_after');
    }
    add_action('core_after_template', 'theme_ad_after');
    
    // Removes container from wp_nav_menu's menu output
    // wp_nav_menu always outputs a div container otherwise, despite the arguments passed to it
    //
    function theme_fix_menus($args = '') {
    	$args['container'] = false;
    	return $args;
    }
    add_filter('wp_nav_menu_args', 'theme_fix_menus');
    
    // Automatically adds prettyPhoto rel attributes to embedded images
    //
    function theme_content_lightbox($content) {
    	$pattern = '/<a(.*?)href="(.*?).(bmp|gif|jpeg|jpg|png)"(.*?)>/i';
      	$replacement = '<a$1href="$2.$3" data-rel="prettyPhoto"$4>';
    
    	return preg_replace($pattern, $replacement, $content);
    }
    add_filter('the_content', 'theme_content_lightbox');
    
    // Replaces admin panel login logo with theme logo
    //
    function theme_login_logo() {
    	echo '<style type="text/css">';
    	echo 'h1 a { background-image: url(' .core_options_get('login_logo'). ') !important; }';
    	echo '</style>';
    }
    add_action('login_head', 'theme_login_logo');
    
    // Outputs the page title and breadcrumbs before a template page
    //
    function theme_page_title() {
    	if (!is_front_page()) {
    		global $post;
    		echo '<div class="title-row">';
    		if (core_options_get('titles') == true){
    			if (is_category())
    				echo '<h1 class="title entry-title">',single_cat_title( '', false ), '</h1>';
    			elseif (is_archive() && is_day() )
    				printf( __( '<h1 class="title entry-title">Daily Archives: %s', 'themedutch' ), get_the_date() . '</h1>' );
    			elseif (is_archive() && is_month() )
    				printf( __( '<h1 class="title entry-title">Monthly Archives: %s', 'themedutch' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'themedutch' ) ) . '</h1>' );
    			elseif (is_archive() && is_year() )
    				printf( __( '<h1 class="title entry-title">Yearly Archives: %s', 'themedutch' ), get_the_date( _x( 'Y', 'yearly archives date format', 'themedutch' ) ) . '</h1>' );
    			elseif (is_tag() )
    				printf( __( '<h1 class="title entry-title">Showing posts with tag: %s', 'themedutch' ), single_term_title("", false) . '</h1>' );
    			elseif (is_search() )
    				printf( __( '<h1 class="title entry-title">Search Results: %s', 'themedutch' ) , '"<span>' . get_search_query() . '</span>"' . '</h1>' );
    			else {
    				if ( ! core_is_buddypress_pages() ){
    					echo '<h1 class="title entry-title">', get_the_title($post->ID), '</h1>';
    				}
    			}
    		}
    
    		if (core_options_get('breadcrumbs') == true) {
    			echo '<div class="theme-breadcrumbs">';
    
    			if( ! core_is_buddypress_pages() )
    				core_breadcrumbs(' \ ', __('You are here:', THEME_SLUG));
    
    			echo '</div>';
    		}
    		echo '</div>';
    
    	}
    }
    add_action('core_before_template', 'theme_page_title');
    
    // Outputs the theme's slider area + widget if any
    //
    function theme_slider_area() {
    	$post_type = get_post_type();
    	$category = get_query_var('cat');
    	$current_category = get_category ($category);
    	$slug = '';
    
    	if ( is_category() ){
    		$post_type = 'theme';
    		$slug = '_'.$current_category->slug;
    	}
    
    	if (!$post_type)
    		return;
    
    	$slider = core_options_get('slider'.$slug, $post_type);
    	if (!$slider || $slider == 'none')
    		return;
    
    	if ( is_category() ){
    		// Slider widget
    		$widget_position = '';
    		$widget_sidebar = '';
    	} else {
    		// Slider widget
    		$widget_position = core_options_get('widget_position', $post_type);
    		$widget_sidebar = core_options_get('widget_sidebar', $post_type);
    	}	
    
    	echo '<div class="row" id="theme-slider-row">';
    
    	// Left widget
    	if ($widget_position == 'left' && $widget_sidebar) {
    		?>
    		<div class="border-box" style="width: 32.89%; float: left; padding-left: 10px; padding-right: 15px;">
    			<ul class="border-box" id="theme-slider-widget">
    				<?php dynamic_sidebar($widget_sidebar); ?>
    
    		</div>
    		<div class="border-box" style="width: 67.10%; float: left; padding-right: 10px;">
    			<div class="border-box" id="theme-slider">
    				<?php core_slider($slider); ?>
    			</div>
    		</div>
    		<div class="floatfix"></div>
    		<?php
    
    	// Right widget
    	} else if ($widget_position == 'right' && $widget_sidebar) {
    		?>
    		<div class="border-box" style="width: 72%; float: left; padding-left: 10px; padding-right: 15px;">
    			<div class="border-box" id="theme-slider">
    				<?php core_slider($slider); ?>
    			</div>
    		</div>
    		<div class="border-box" style="width: 27.69%; float: left; padding-right: 10px;">
    			<ul class="border-box" id="theme-slider-widget">
    				<?php dynamic_sidebar($widget_sidebar); ?>
    
    		</div>
    		<div class="floatfix"></div>
    		<?php
    
    	// No widget
    	} else {
    		?>
    		<div class="border-box" style="width: 100%; float: left; padding: 0;">
    			<div id="theme-slider">
    				<?php core_slider($slider); ?>
    			</div>
    		</div>
    		<div class="floatfix"></div>
    		<?php
    	}
    
    	echo '</div>';
    }
    
    // Miscellaneous
    //
    
    // Post thumbnail support
    add_theme_support('post-thumbnails');
    set_post_thumbnail_size(300, 275, false);
    add_image_size('post-featured', 1080, 200, false);
    add_image_size('post-excerpt', 1080, 275, true);
    add_image_size('tdac-thumb', 90, 90, true);
    
    // Feed links
    add_theme_support('automatic-feed-links');
    
    // Content width
    if (!isset($content_width))
    	$content_width = 1080;
    
    // Editor styling
    add_editor_style('css/editor-style.css');
    
    // Post Formats
    //add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat' ) );
    
    // Theme customize option
    function theme_menus() {
    	if (function_exists('_wp_customize_include'))
    		add_theme_page(sprintf(__('Customize %s', THEME_SLUG), THEME_NAME), sprintf(__('Customize %s', THEME_SLUG), THEME_NAME), 'edit_theme_options', 'customize.php', '', '', 6);
    }
    add_action('admin_menu', 'theme_menus');
    
    // Font preview text
    core_fonts_preview_text(__('Amazingly few discotheques provide jukeboxes.', THEME_SLUG));
    
    // ****************************************************************
    // BuddyPress Integration
    // ****************************************************************
    
    if ( !function_exists( 'bp_is_active' ) )
    	return;
    
    // If BuddyPress is not activated, switch back to the default WP theme
    if ( !defined( 'BP_VERSION' ) )
    	switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
    
    if ( !function_exists( 'core_buddypress_setup' ) ) :
    /**
     * Sets up theme defaults and registers support for various WordPress and BuddyPress features.
     *
     * Note that this function is hooked into the after_setup_theme hook, which runs
     * before the init hook. The init hook is too late for some features, such as indicating
     * support post thumbnails.
     *
     * To override core_buddypress_setup() in a child theme, add your own core_buddypress_setup to your child theme's
     * functions.php file.
     *
     * @global object $bp Global BuddyPress settings object
     * @since 1.5
     */
    function core_buddypress_setup() {
    	global $bp;
    
    	// Load the AJAX functions for the theme
    	require( THEME_PATH . '/core/buddypress/_inc/ajax.php' );
    
    	if ( !is_admin() ) {
    		// Register buttons for the relevant component templates
    		// Friends button
    		if ( bp_is_active( 'friends' ) )
    			add_action( 'bp_member_header_actions',    'bp_add_friend_button' );
    
    		// Activity button
    		if ( bp_is_active( 'activity' ) )
    			add_action( 'bp_member_header_actions',    'bp_send_public_message_button' );
    
    		// Messages button
    		if ( bp_is_active( 'messages' ) )
    			add_action( 'bp_member_header_actions',    'bp_send_private_message_button' );
    
    		// Group buttons
    		if ( bp_is_active( 'groups' ) ) {
    			add_action( 'bp_group_header_actions',     'bp_group_join_button' );
    			add_action( 'bp_group_header_actions',     'bp_group_new_topic_button' );
    			add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
    		}
    
    		// Blog button
    		if ( bp_is_active( 'blogs' ) )
    			add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
    	}
    }
    add_action( 'after_setup_theme', 'core_buddypress_setup' );
    endif;
    
    if ( !function_exists( 'core_buddypress_enqueue_scripts' ) ) :
    /**
     * Enqueue theme javascript safely
     *
     * @see http://codex.wordpress.org/Function_Reference/wp_enqueue_script
     * @since 1.5
     */
    function core_buddypress_enqueue_scripts() {
    	// Bump this when changes are made to bust cache
    	$version = '20120110';
    
    	// Enqueue the global JS - Ajax will not work without it
    	wp_enqueue_script( 'bptheme-ajax-js', get_template_directory_uri() . '/core/buddypress/_inc/global.js', array( 'jquery' ), $version );
    
    	// Add words that we need to use in JS to the end of the page so they can be translated and still used.
    	$params = array(
    		'my_favs'           => __( 'My Favorites', 'buddypress' ),
    		'accepted'          => __( 'Accepted', 'buddypress' ),
    		'rejected'          => __( 'Rejected', 'buddypress' ),
    		'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ),
    		'show_all'          => __( 'Show all', 'buddypress' ),
    		'comments'          => __( 'comments', 'buddypress' ),
    		'close'             => __( 'Close', 'buddypress' ),
    		'view'              => __( 'View', 'buddypress' ),
    		'mark_as_fav'	    => __( 'Favorite', 'buddypress' ),
    		'remove_fav'	    => __( 'Remove Favorite', 'buddypress' )
    	);
    
    }
    add_action( 'wp_enqueue_scripts', 'core_buddypress_enqueue_scripts' );
    endif;
    
    if ( !function_exists( 'core_buddypress_enqueue_styles' ) ) :
    /**
     * Enqueue theme CSS safely
     *
     * For maximum flexibility, BuddyPress Default's stylesheet is enqueued, using wp_enqueue_style().
     * If you're building a child theme of bp-default, your stylesheet will also be enqueued,
     * automatically, as dependent on bp-default's CSS. For this reason, bp-default child themes are
     * not recommended to include bp-default's stylesheet using @import.
     *
     * If you would prefer to use @import, or would like to change the way in which stylesheets are
     * enqueued, you can override core_buddypress_enqueue_styles() in your theme's functions.php file.
     *
     * @see http://codex.wordpress.org/Function_Reference/wp_enqueue_style
     * @see http://codex.buddypress.org/releases/1-5-developer-and-designer-information/
     * @since 1.5
     */
    function core_buddypress_enqueue_styles() {
    
    	// Bump this when changes are made to bust cache
    	$version = '20120110';
    
    	// Register our main stylesheet
    	wp_register_style( 'bp-mikmag-main', get_template_directory_uri() . '/core/buddypress/bp-mikmag.css', array(), $version );
    
    	// If the current theme is a child of bp-default, enqueue its stylesheet
    	if ( is_child_theme() && 'bp-default' == get_template() ) {
    		wp_enqueue_style( get_stylesheet(), get_stylesheet_uri(), array( 'bp-mikmag-main' ), $version );
    	}
    
    	// Enqueue the main stylesheet
    	wp_enqueue_style( 'bp-mikmag-main' );
    
    	// Default CSS RTL
    	if ( is_rtl() )
    		wp_enqueue_style( 'bp-mikmag-main-rtl',  get_template_directory_uri() . '/core/buddypress/bp-mikmag-rtl.css', array( 'bp-defmikmagault-main' ), $version );
    
    		if ( is_rtl() )
    			wp_enqueue_style( 'bp-mikmag-responsive-rtl', get_template_directory_uri() . '/core/buddypress/_inc/css/responsive-rtl.css', array( 'bp-default-responsive' ), $version );
    
    }
    add_action( 'wp_enqueue_scripts', 'core_buddypress_enqueue_styles' );
    endif;
    
    if ( !function_exists( 'core_buddypress_use_wplogin' ) ) :
    /**
     * BP Template Pack doesn't use bp-default's built-in sidebar login block,
     * so during no access requests, we need to redirect them to wp-login for
     * authentication.
     *
     * @since 1.2
     */
    function core_buddypress_use_wplogin() {
    	// returning 2 will automatically use wp-login
    	return 2;
    }
    add_filter( 'bp_no_access_mode', 'core_buddypress_use_wplogin' );
    endif;
    
    /**
     * Hooks into the 'bp_get_activity_action_pre_meta' action to add secondary activity avatar support
     *
     * @since 1.2
     */
    function core_buddypress_activity_secondary_avatars( $action, $activity ) {
    	// sanity check - some older versions of BP do not utilize secondary activity avatars
    	if ( function_exists( 'bp_get_activity_secondary_avatar' ) ) :
    		switch ( $activity->component ) {
    			case 'groups' :
    			case 'friends' :
    				// Only insert avatar if one exists
    				if ( $secondary_avatar = bp_get_activity_secondary_avatar() ) {
    					$reverse_content = strrev( $action );
    					$position        = strpos( $reverse_content, 'a<' );
    					$action          = substr_replace( $action, $secondary_avatar, -$position - 2, 0 );
    				}
    				break;
    		}
    	endif;
    
    	return $action;
    }
    add_filter( 'bp_get_activity_action_pre_meta', 'core_buddypress_activity_secondary_avatars', 10, 2 );
    
    /**  BP 1.2.x *************************************************************/
    if ( version_compare( BP_VERSION, '1.3', '<' ) ) :
    
    	/*****
    	 * Add support for showing the activity stream as the front page of the site
    	 */
    
    	/* Filter the dropdown for selecting the page to show on front to include "Activity Stream" */
    	function core_buddypress_wp_pages_filter( $page_html ) {
    		if ( 'page_on_front' != substr( $page_html, 14, 13 ) )
    			return $page_html;
    
    		$selected = false;
    		$page_html = str_replace( '</select>', '', $page_html );
    
    		if ( core_buddypress_page_on_front() == 'activity' )
    			$selected = ' selected="selected"';
    
    		$page_html .= '<option class="level-0" value="activity"' . $selected . '>' . __( 'Activity Stream', 'buddypress' ) . '</option></select>';
    		return $page_html;
    	}
    	add_filter( 'wp_dropdown_pages', 'core_buddypress_wp_pages_filter' );
    
    	/* Hijack the saving of page on front setting to save the activity stream setting */
    	function core_buddypress_page_on_front_update( $oldvalue, $newvalue ) {
    		if ( !is_admin() || !is_super_admin() )
    			return false;
    
    		if ( 'activity' == $_POST['page_on_front'] )
    			return 'activity';
    		else
    			return $oldvalue;
    	}
    	add_action( 'pre_update_option_page_on_front', 'core_buddypress_page_on_front_update', 10, 2 );
    
    	/* Load the activity stream template if settings allow */
    	function core_buddypress_page_on_front_template( $template ) {
    		global $wp_query;
    
    		if ( empty( $wp_query->post->ID ) )
    			return locate_template( array( 'activity/index.php' ), false );
    		else
    			return $template;
    	}
    	add_filter( 'page_template', 'core_buddypress_page_on_front_template' );
    
    	/* Return the ID of a page set as the home page. */
    	function core_buddypress_page_on_front() {
    		if ( 'page' != get_option( 'show_on_front' ) )
    			return false;
    
    		return apply_filters( 'core_buddypress_page_on_front', get_option( 'page_on_front' ) );
    	}
    
    	/* Force the page ID as a string to stop the get_posts query from kicking up a fuss. */
    	function core_buddypress_fix_get_posts_on_activity_front() {
    		global $wp_query;
    
    		if ( !empty($wp_query->query_vars['page_id']) && 'activity' == $wp_query->query_vars['page_id'] )
    			$wp_query->query_vars['page_id'] = '"activity"';
    	}
    	add_action( 'pre_get_posts', 'core_buddypress_fix_get_posts_on_activity_front' );
    
    endif;
    
    // ****************************************************************
    // Plugin style override
    // ****************************************************************
    
    add_action( 'wp_print_styles', 'plugin_override_styles', 11 );
    
    function plugin_override_styles() {
    
    	// check if Socialbox is active
    	if ( is_plugin_active('socialbox/socialbox.php')) {
        	wp_dequeue_style('socialbox');
        }
    
        // check if BBPress is active
    	if ( is_plugin_active('bbpress/bbpress.php')) {
        	wp_register_style( 'bbp-mikmag',
    		    THEME_URI . '/core/bbpress/bbp-mikmag.css',
    		    array(),
    		    '20120727',
    		    'all' );
        	wp_enqueue_style('bbp-mikmag');
        }
    
    }
    
    remove_filter('widget_text', 'do_shortcode');
    add_filter('widget_text', 'do_shortcode');
    
    ?>
    Thread Starter utilibre

    (@utilibre)

    @agelonwl, thanks, though i commented there as well, that thread doesn’t work for me.

    OK.
    You can add manually add the funcion to register sidebars. later, u’ll see the Widget Admin , at the right your sidebars. But u must notice, that u’ll be modifying the theme.
    If it’s possible change the theme to other that contains the sidebar register function yet.

    Thread Starter utilibre

    (@utilibre)

    but where do i add the function to register sidebars? also which specific code?

    Try to ADD the second code , just below your code like I describe:

    function theme_register_widgets() {
    	if (!is_blog_installed())
    		return;
    
    	register_widget('TD_Widget_Categories');
    	register_widget('td_adWidget');
    	register_widget('td_postWidget');
    	register_widget('td_tabbedWidget');
    
    }
    add_action('widgets_init', 'theme_register_widgets');

    And the code could be something like this:

    function YOURTHEMENAME_widgets_init() {
    register_sidebar(
    array(
    'name' => 'Sidebar',
    'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    'after_widget' => '</aside><!-- .widget -->',
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>'
    )
    );
    }
    
    add_action( 'widgets_init', 'YOURTHEMENAME_widgets_init' );

    Notice that “YOURTHEMENAME” must be replaced with the name of your theme.

    good luck!

    Thread Starter utilibre

    (@utilibre)

    No luck. After adding the code, Sidebar Widget area appeared in the admin panel widgets area but there is no sidebar on a single event page yet though.

    Do I need to add an events-single.php to my theme’s folder and add <?php get_sidebar(); ?> code? I hesitate this option because, when I used it before, it removed the comments feature.

    utilibre,

    Now u r talking about WP general things. I recommends u, post this thread in other forum or see WP codex docs.

    Hi @utilibre,

    yes, you can try to used single-event.php just like my post above; you can re-copy your theme single.php and then rename it to single-event.php – to enable comments on events page Settings > Pages > Event Pages > Enable Comments

    Thread Starter utilibre

    (@utilibre)

    Even though, i added the extra function bit, created a new single-event.php in my theme folder and added the <?php get_sidebar( ‘Sidebar’ ); ?> and changed to posts on events settings – still no luck šŸ™

    here is the single-event.php file of mine if helps.

    <?php

    // TODO: Translate

    $meta = core_options_get(‘meta’);

    while (have_posts()) {
    the_post();

    // Article start
    $post_classes = get_post_class();
    $index = array_search(‘hentry’, $post_classes);
    unset($post_classes[$index]);
    $post_classes = implode(‘ ‘, $post_classes);
    echo ‘<article class=”theme-article entry-content ‘, $post_classes, ‘”>’;

    // Featured image
    $featured_img = (int)core_options_get(‘featured_img’);
    if (has_post_thumbnail() && $featured_img) {
    echo ‘<div class=”featured-image”>’;
    the_post_thumbnail(‘post-featured’);
    echo ‘</div>’;
    }

    // Output post meta information
    if (get_post_type() == ‘post’ && $meta) {
    ?>
    <ul class=”meta”>
    <li class=”icon date post-date updated”>
    <?php echo get_the_date(); ?>

    <li class=”icon comments”>
    #comments”> <?php comments_number(‘no comments’, ‘one comment’, ‘% comments’); ?>

    <?php if (has_category()) { ?>
    <li class=”icon category”>
    <?php the_category(‘ : ‘); ?>

    <?php } ?>

    <?php the_tags(‘<li class=”icon tags”>’, ‘ ‘, ”); ?>

    <div class=”floatclear”></div>
    <?php
    }

    //echo ‘<div class=”shortcode-divider” style=”border: none;”></div>’;

    // Output title for posts
    //if ( is_single())
    // echo ‘<h2>’ . get_the_title() . ‘</h2>’;

    // Output content
    // If the content is really empty, right sidebars will go left, so something is always put in it
    $content = apply_filters(‘the_content’, get_the_content());
    if ($content == ”) {
    $content = ‘ ‘;
    echo wpautop($content);
    } else {
    //the_content();
    echo $content;
    }

    //if (function_exists(‘is_woocommerce’) && function_exists(‘is_checkout’) || function_exists(‘is_bbpress’))
    // if (!is_woocommerce() && is_checkout() || is_cart())
    // echo $content;
    // elseif(is_bbpress())
    // echo $content;
    // else
    // echo wpautop($content);
    //else
    // echo wpautop($content);

    // Pagination
    wp_link_pages(array(
    ‘before’ => ‘<ul class=”theme-pagination”>’,
    ‘after’ => ”,
    ));

    // Author info
    if (is_single())
    get_template_part(‘author’, ‘content’);

    // Related posts
    if (is_single()) {
    $tags = wp_get_post_tags($post->ID);
    $cats = wp_get_post_categories($post->ID);

    if ($tags || $cats) {
    // Construct array of just tag slugs
    $new_tags = array();
    foreach ($tags as $tag)
    $new_tags[] = $tag->slug;

    // Query related posts
    $related_posts = get_posts(array(
    ‘tag_slug__in’ => $new_tags,
    ‘category__in’ => $cats,
    ‘post__not_in’ => array($post->ID),
    ‘numberposts’ => 6,
    ‘order’ => ‘ASC’,
    ‘orderby’ => ‘rand’,
    ));

    if ($related_posts) {
    $items = ”;
    foreach ($related_posts as $related_post) {
    if (!has_post_thumbnail($related_post->ID))
    continue;

    $thumb_id = get_post_thumbnail_id($related_post->ID);
    $post_image = wp_get_attachment_image_src($thumb_id, ‘thumbnail’);
    $alt_text = get_post_meta($thumb_id, ‘_wp_attachment_image_alt’, true);

    $items .= ‘
    <div class=”post”>
    ID) . ‘” rel=”bookmark” title=”‘ . $alt_text . ‘”>
    <div class=”title”>’ . $related_post->post_title . ‘</div>
    <img src=”‘ . $post_image[0] . ‘” class=”thumbnail”>

    </div>
    ‘;
    }

    if ($items != ”) {
    echo ‘<div class=”shortcode-header”><h6>RELATED ITEMS</h6></div>’;
    echo ‘<div class=”related-posts”>’;
    echo $items;
    echo ‘</div>’;
    echo ‘<div class=”floatclear”></div>’;
    }
    }
    }
    }

    echo ‘</article>’;

    comments_template();
    }

    ?>

    <?php get_sidebar( ‘Sidebar’ ); ?>

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    I can’t comment on your specific code, but if you’re creating the template correctly (e.g. try adding some random text and make sure you see it on an event page), then provided you are using the right name in get_sidebar() then it should work.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Single Event Sidebar Issue’ is closed to new replies.