Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #79154
    stecu
    Member

    Hi,

    Im trying to add custom widget area (field for some extra baner) under featured-content-wrap <div> using simple example:

    in function.php:

    if ( function_exists('register_sidebar') )
      register_sidebar(array(
        'name' => 'Name of Widgetized Area',
        'before_widget' => '<div class = "widgetizedArea">',
        'after_widget' => '</div>',
        'before_title' => '<h3>',
        'after_title' => '</h3>',
      )
    );

    and on line 96 before </div><!– .wrapper –> in file catchresponsive-featured-content.php
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Name of Widgetized Area") ) : ?><?php endif; ?>

    When I try save the file I got error:
    Parse error: syntax error, unexpected T_STRING in wp-content/themes/catch-responsive/inc/catchresponsive-featured-content.php on line 96

    Also when I removed this line I got this same error (I need to update proper file via FTP)
    What is wrong ?

    #79179
    Sakin
    Keymaster

    @stecu: You shouldn’t edit any core theme files directly. You shouldn’t add/edit any files inside catch-resposnive theme directory. As all these files will be reverted back to original when you update or upgrade the theme.

    So, if you want to add extra sidebar and add it below featured content. Then you need to build child theme. You can download sample child theme from http://catchthemes.com/blog/create-child-theme-wordpress/ and then add the following code in your child theme functions.php file

    /**
     * Register extra sidebars
     *
     * @since Catch Responsive
     */
    function catchresponsive_child_widgets_init() {
    
    	//under featured content sidebar
    	register_sidebar( array(
    		'name' => __( 'Under Featured Content Sidebar', 'catch-responsive' ),
    		'id' => 'sidebar-under-featured-content',
    		'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-wrap">',
    		'after_widget'  => '</div><!-- .widget-wrap --></section><!-- .widget -->',
    		'before_title'  => '<h4 class="widget-title">',
    		'after_title'   => '</h4>',
    		'description'	=> __( 'This is the extra sidebar under Featured Content', 'catchresponsive' ),
    	) );	
    
    }
    add_action( 'widgets_init', 'catchresponsive_child_widgets_init' );
    
    /**
     * Add extra sidebar below Featurd Content 
     */
    add_action( 'catchresponsive_before_content', 'catchbox_under_featured_content_sidebar', 50 ); 
    function catchbox_under_featured_content_sidebar() {
    	if ( is_active_sidebar( 'sidebar-under-featured-content' ) ) : 
    		?>
    		<div id="sidebar-under-featured-content" class="widget-area">
    			<div class="wrapper">
    				<?php dynamic_sidebar( 'sidebar-under-featured-content' ); ?>
    			</div>
    		</div> <!-- #sidebar-under-featured-content -->
    	<?php endif;
    }
Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘widget area problem’ is closed to new replies.