Forums

Widgets disappearing (70 posts)

  1. alanft
    Member
    Posted 5 months ago #

    khoward87: your preg_match and preg_replace patterns don't look right. now that could be because the forum system here mangled it.

    i've just tested it again on a 2.7 system and it's OK (not sure about ttftitles on 2.8 yet). so if you use the same function as on http://wordpress.org/extend/plugins/widget-logic/other_notes/ which uses this pattern:

    preg_match("/<h2[^>]*>([^<]+)/",$content, $matches);

    etc. So, so long as you have ttftitles working ok, with that code and and the right add_filter in your themes functions.php and the 'widget_content' option ticked. all will work well.

  2. alanft
    Member
    Posted 5 months ago #

    itzsnider, glad you've tracked down the problem.

    assuming domtabs is that thing that i linked to, it says in step 5 to edit your sidebar.php. how did you edit it? the text i see on that page doesn't look very widget friendly

  3. itzsnider
    Member
    Posted 5 months ago #

    <?php include (TEMPLATEPATH . '/domtabs.php'); ?> is what I call Alan. This is why I am a little confused.

    And then within the domtbas.php I have this
    <?php query_posts('cat=6&showposts=7'); ?>
    <?php while (have_posts()) : the_post(); ?>

  4. "><?php the_title(); ?>
  5. <?php endwhile;?>

  • alanft
    Member
    Posted 5 months ago #

    you're going to have to give me a lot more info to go on as I can't find any reference to domtabs.php anywhere on the net wrt to installing domtabs on WP, and it sounds like you have quite a customised theme.

    what's in the sidebar.php and where is that line you mention (include (TEMPLATEPATH . '/domtabs.php'); ) in your theme (which seems to execute a custom query to list the 7 most recent posts in category 6 somewhere on the page)

    if the sidebar runs after that code, you need a 'wp_reset_query();' after the endwhile, otherwise all the conditional tags will not evaluate against the main page put against the 'this is an archive page of category 6' query you are doing there.

  • itzsnider
    Member
    Posted 5 months ago #

    YOU ARE THE MAN!!!!!

    I added the wp_reset_query(); after the endwhile in my domtabs.php and we are good to go!!

    THANK YOU FOR ALL OF YOUR HELP ALONG WITH YOUR AWESOME PLUGIN!!

  • alanft
    Member
    Posted 5 months ago #

    great!

    that's trouble for me though, cos i intended to replicate precisely that fix with the new option that appears in the dev version 'wp_reset_query'. let me see about that...

    actually it would be great to know if the new feature does fix it for you. take out that code fix, update to the dev version (if you haven't already - sorry i lost track!) and tick the "Use 'wp_reset_query' fix" option on the widget admin page.

    it would be wonderful to know that worked for you.

  • itzsnider
    Member
    Posted 5 months ago #

    I did try that first. With domtabs being BEFORE the widgets I assume it doesn't unless that tag is before the tabs.

  • shinpseudo
    Member
    Posted 5 months ago #

    I've been keeping my eye on this thread, and I'm still having the same issue occur where a PHP Code Widget vanishes upon save, when in use simultaneously with Widget Logic. The newest version of Widget Logic you've posted fixed where the logic field would remove itself, but if I check "Use 'wp_reset_query' fix", it always unchecks itself on save.

    I wonder still if the issue is with the PHP Code Widget. Only one instance of it can now live in the sidebar at any given point. Has Otto weighed in on this at all?

  • alanft
    Member
    Posted 5 months ago #

    i can see php code widgets vanishing in 2.8 without widget logic active

    add a php widget, add another, wait for the ajax saves in each case. refresh the page. first widget has gone.

    i'll have another look at the reset_query option not saving...

  • papascott
    Member
    Posted 5 months ago #

    My testing with the PHP Code Widget revealed that even with the default theme and no other plugins installed, multiple instances could be not saved.

    The PHP Code Widget is basically a one-line edit of the standard Text Widget, which in 2.8 was adapated to the new Widget API. So I applied the edit to the new Text Widget, and came up with something that works for me. If you know how to write plugins and want to try it, here it is... I offer no guarantees that it will work for you!

    class PS_PHP_Widget extends WP_Widget {
    
    	function PS_PHP_Widget() {
    		$widget_ops = array('classname' => 'ps_php_widget', 'description' => __('Arbitrary PHP code, text or HTML'));
    		$control_ops = array('width' => 400, 'height' => 350);
    		$this->WP_Widget('ps_php_text', __('PS PHP Text'), $widget_ops, $control_ops);
    	}
    
    	function widget( $args, $instance ) {
    		extract($args);
    		$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
    		$text = apply_filters( 'widget_text', $instance['text'] );
    		echo $before_widget;
    		if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
    			<div class="psphpwidget"><?php echo eval('?>'.$text); ?></div>
    		<?php
    		echo $after_widget;
    	}
    
    	function update( $new_instance, $old_instance ) {
    		$instance = $old_instance;
    		$instance['title'] = strip_tags($new_instance['title']);
    		if ( current_user_can('unfiltered_html') )
    			$instance['text'] =  $new_instance['text'];
    		else
    			$instance['text'] = wp_filter_post_kses( $new_instance['text'] );
    		return $instance;
    	}
    
    	function form( $instance ) {
    		$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
    		$title = strip_tags($instance['title']);
    		$text = format_to_edit($instance['text']);
    ?>
    		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
    		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
    
    		<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
    
    <?php
    	}
    }
    
    add_action('widgets_init', create_function('', 'return register_widget("PS_PHP_Widget");'));
  • alanft
    Member
    Posted 5 months ago #

    nice work! i will try that - and double-check if there is any problem working alongside WL too.

  • ShackDougall
    Member
    Posted 5 months ago #

    papascott,

    Your code works for me. Thanks for posting it!

  • Otto42
    Moderator
    Posted 5 months ago #

    Sorry about that. The PHP Code widget should be fixed for 2.8 now. Look for an update to version 1.2.

  • mllehman
    Member
    Posted 5 months ago #

    I have read this thread, but am a bit confused...

    When I try to add a widget (text or "recently popular") they disappear upon saving. I am using wordpress 2.7.1 and I am also using Widget Logic 0.46. I have not checked the 'wp_reset_query' fix box under Widget Logic Options -- what will this do if I check it? I don't want to mess up all the rest of the widgets on my site.

    What would you recommend that I do to fix this problem? I need to be able to save my widgets without them disappearing...

    Thanks in advance for your help!

  • mllehman
    Member
    Posted 5 months ago #

    ok...so I check and saved the 'wp_reset_query' fix box under Widget Logic Options and this does not fix the problem.

    Any ideas about what I should do now?

  • alanft
    Member
    Posted 5 months ago #

    I don't know what to say - my live site is still 2.7.1 with 0.46 and i can add a text widget no problem. (what's the "recently popular" widget?)

    just FYI, wp_reset_query option won't be relevant - that's to do with making the widgets appear on the correct pages on the actual site, not in the admin interface.

    things you could try though:

    1 - reinstall 0.46 just to be sure

    2 - try switching to the default theme

    3 - try deactivating other plugins to see if that makes a difference. I realise this is quite tricky and may be longwinded - but you'd be doing me a favour if you found a genuine clash between WL and another plugin

    4 - go back to 0.45 if it's getting awkward.

    http://wordpress.org/extend/plugins/widget-logic/download/

    i'm afraid i'll be off the net for a week or so now, so won't be able to follow up quickly. but DO let me know how you get on, and sorry if that advice is a bit of a cop out (but as I can't replicate the problem, I don't know what else to suggest at the mo)

  • mllehman
    Member
    Posted 5 months ago #

    @ alanft ... thanks for your prompt reply!

    Here's where I am now ---

    1. I reinstalled 0.46 and the problem persists.
    2. I would like to avoid switching themes for now.
    3. I couldn't find a conflict with other plugins -- although the "Recently Popular" widget is having a problem too. When I deactivate it, WL still makes my widgets disappear upon saving.

    So, for now, I am using WL 0.45 with no problem. Do you think you could help me troubleshoot this WL 0.46 problem once you get back onto the net?

    I really appreciate your help!

  • khoward87
    Member
    Posted 5 months ago #

    Alan,

    Thank you for replying. I am still just so confused! Maybe I'm making this harder than it should be. Is there anyway you can give me the exact code that I should use? Including the < ? php and everything? I have tried and tried to get it to work but it always messes up my functions.php page and I have to re-upload it.

    Thank you!

  • clrvirtualconnection
    Member
    Posted 5 months ago #

    I don't know....I so want to use this and I can't make any of this work. If I was to pay someone to do this for me...how much usually would it cost? I just want my blog page to have a different sidebar then the rest of my site... UGH!!

  • alanft
    Member
    Posted 4 months ago #

    hello ppl, been off the net for a week, so apologies for the slow turnround.

    hi mllehman - could you switch themes if only for 10 minutes, or on a non-live system. it's a pretty crucial part of trying to troubleshoot your problem by remote here.

    khoward87 - the code on http://wordpress.org/extend/plugins/widget-logic/other_notes/ works fine with the appropriate add_filter code.

  • mllehman
    Member
    Posted 4 months ago #

    @ alanft:

    I switched to the default theme with 0.46 WL installed and the problem persists. I still cannot save a text widget, even from the default theme. I switched back to my regular theme.

    Here is a link to my site: http://sensingarchitecture.com

    I'm not sure what else I can try...any ideas?

  • alanft
    Member
    Posted 4 months ago #

    i'm trying to think what else in your setup could be interfering with this - it's certainly not doing this in my WP2.7.1/WL0.46 setup.

    is it just text widgets (and 'recently popular')? not say, calendar/meta/tag/search - any of the other widgets you can still add?

  • mllehman
    Member
    Posted 4 months ago #

    Here is a list of my widgets showing which work and don't work with WL 0.46/WP 2.7.1 ---

    widgets that DON'T WORK with WL 0.46:
    -- text
    -- recently popular
    -- links

    widgets that WORK with WL 0.46:
    -- pages
    -- calendar
    -- search
    -- archive
    -- recent posts
    -- tag cloud
    -- categories

  • khoward87
    Member
    Posted 4 months ago #

    Okay.. hopefully this will be the last time I have to post with a problem, lol. Here is what I have in my functions.php file. FINALLY I am not getting any errors, but the widgets are still in text format.

    Where/how do I tell the widget titles to display as a specific TTFTitle? Like... if my font style is called "Honey" how do I make the widget titles display in that font? THANKS!!

    '<?php
    add_filter('the_ttftext', 'ttftext_widget_title', 2);
    ?>

    <?php
    function ttftext_widget_title($content='', $widget_id='')
    { preg_match("/<h2[^>]*>([^<]+)/",$content, $matches);
    $heading=$matches[1];
    $insert_img=the_ttftext( $heading, false );
    $content=preg_replace("/(<h2[^>]*>)[^<]+/","$1$insert_img",$content,1);
    return $content;
    }
    ?>'

  • alanft
    Member
    Posted 4 months ago #

    the filter you are hooking into is called 'widget_content' - there is no filter called 'the_ttftext'!

    http://www.hostscope.com/wordpress-plugins/ttftitles-wordpress-plugin/

    explains about how you call the the_ttftext function to use the style of text you want

  • agoranet
    Member
    Posted 4 months ago #

    Ok - not sure if my problem is the same are you are describing or not...

    WP 2.7
    WL .46

    The only time I have a problem is adding a second widget of the same kind. If I add a Text widget and a Search Widget - no problem. If I have a text widget there and add a second text widget, when I click "Save" the 2nd text widget disappears. The note above the widget column says "You are using 2 widgets in the sidebar." but it only shows the one. It's like part of the system thinks I have 2 and part thinks I have one.

    I've never hit this problem with any other combination of plugins or WP versions until now... but still not sure if it's the WL plugin causing the problem.

  • alanft
    Member
    Posted 4 months ago #

    thanks, that's a new observation. does the problem go if you roll back to .45?

  • secretphotolist
    Member
    Posted 4 months ago #

    I have a question. Sorry, but I'm a bit of a PHP noob so the coding for this plugin is not something I can figure out yet. How would I go about just excluding widgets from all but on or two pages? Thank you for any help you can provide.

    Eric

  • Torvon
    Member
    Posted 4 months ago #

    Hm - perhaps this is the right thread?

    I have problems with widgets disappearing as well - but not only from the sidebar (2.8.2), but also from the main source where you can drag them out.

    Happened to my "category" widget. It is nowhere to be seen anymore since I dropped it once from the sidebar ... so ... how do I get it "back"?

    ta-ta
    E.

  • brorox
    Member
    Posted 4 months ago #

    Text widgets are giving me fits as well. All I want is a simple Text widget in a sidebar field on my Homepage and another Text widget in the sidebar field of my other pages. The first is just to be a list of tour dates while the second is to be a jpeg or a rotating gif.

    When I add the second, the first goes away. When I try to add content to the second, it does not save it (even after it nuking my first widget). As of right now I'm showing the second text widget on the site. However, in the content management page, it is showing there is no Text Widget in the second but there is one in the first. So I can't even edit the widget that is showing on the site.

    Confounding.

    www.dotdotdotnot.net
    latest version of Wordpress - 2.8??

  • 1 2 3

    Reply »

    You must log in to post.

    About this Topic

    Tags