• I am working on my client theme wanted to create new widget area at home.
    In my functions.php I have put:

    register_sidebar( array(
    ‘name’ => ‘1’,
    ‘id’ => ‘1’,
    ‘class’ => ‘page45’,
    ‘before_widget’ => ‘<div>’,
    ‘after_widget’ => ‘</div>’,

    ) );

    }
    add_action( ‘widgets_init’, ‘arphabet_widgets_init’ );

    In my sidebar.php I have the following snippet of code:

    <?php
    if (is_front_page()) {
    ?>
    <div class=”page45″>
    <?php dynamic_sidebar( ‘1’ ); ?>
    </div>
    <?php
    }; //end if
    ?>

    When I am in the Widgets Admin I drag the Text and I type:

    Some Basic HTML CODE.

    I then save. I then go to the user site and it shows that this has been pushed over. However if I refresh the Widgets Admin page then the text widget is gone, but on website HTML code is still showing the results..
    Can you point me in the right direction.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter kuhashmi

    (@kuhashmi)

    Here is my Actual Sidebar.php file:

    <?php
    
    	global $wp_query;
    
    	if (isset($wp_query->post->ID)) {
    		$page_id = $wp_query->post->ID;
    	} else {
    		$page_id =  false;
    	}
    
    	if(is_home()) {
    
    		if('page' == get_option('show_on_front')) {
    			if(is_front_page()) {
    				$page_id = get_option('page_on_front');
    			} else {
    				$page_id = get_option('page_for_posts');
    			}
    		}
    	}
    
    	$sidebar = get_post_meta( $page_id, THEME_NAME.'_sidebar_select', true );
    	if ( $sidebar=='' ) {
    		$sidebar='default';
    	}
    
    	$sidebarPosition = get_option ( THEME_NAME."_sidebar_position" );
    	$sidebarPositionCustom = get_post_meta ( OT_page_id(), THEME_NAME."_sidebar_position", true ); 
    
    	if( $sidebarPosition == "left" || ( $sidebarPosition == "custom" &&  $sidebarPositionCustom == "left") ) {
    		$sidebarClass=" left";
    	} else if( $sidebarPosition == "right" || ( $sidebarPosition == "custom" &&  $sidebarPositionCustom == "right") ) {
    		$sidebarClass=" right";
    	} else if ( $sidebarPosition == "custom" && !$sidebarPositionCustom ) {
    		$sidebarClass=" right";
    	} else if( $sidebarPosition == "page45" || ( $sidebarPosition == "custom" &&  $sidebarPositionCustom == "page45") ) {
    		$sidebarClass=" page45";
    	} else {
    		$sidebarClass=" right";
    	}
    ?>
    					<!-- BEGIN .right-content -->
    					<div class="sidebar-block<?php echo $sidebarClass;?>">
    						<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar($sidebar) ) : ?>
    						<?php endif; ?>
    					<!-- END .right-content -->
    					</div>
    
    <?php
    if (is_front_page()) {
    ?>
    <div class="page45">
    <?php if(!function_exists('dynamic_sidebar')|| !dynamic_sidebar('1')){ ?>
    			<?php } ?>
    </div>
    <?php
    }; //end if
    ?>
    Thread Starter kuhashmi

    (@kuhashmi)

    what I did notice is after a change is made i log out when made.
    There is a time when I did a change and saved it but when i went back to that widget the change was not there.

    hi!! my friend i have the same problem… you can solve it? tnks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress Widget not saving my text widget’ is closed to new replies.