WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Widgets
[resolved] Frontpage rule not working (21 posts)

  1. stianjaco
    Member
    Posted 1 year ago #

    Hi! I love this plugin. But I think I found a bug or a missing rule.
    If I select a static page as frontpage, there are no rules for that, only if frontpage is articles.

    http://wordpress.org/extend/plugins/dynamic-widgets/

  2. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Because you selected the front-page to be a static page. The DW options can be found under the static page module.

  3. stianjaco
    Member
    Posted 1 year ago #

    Yes I tried that. Selecting "NO" to everything except the page that is my front page.. still, did't work

  4. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Try the OLD method.

    Go to the DW overview page, at the bootom click 'Advanced'. Tick the checkbox for OLD method.

  5. stianjaco
    Member
    Posted 1 year ago #

    Ok, so I've activated the "Old Method". Set my widget to "NO on all".
    When down to pages and selected only the page "Hovedside (Front page)".
    Nothing..
    I also tried to navigate to that page, /?page_id=44
    Nothing..
    Any ideas on what I'm doing wrong? I'm using the latest version of wordpress if that is an issue..
    EDIT:
    - Tried to activate/deactivate permalinks. no results
    - Tried to enable / disable at page for post. no results

  6. stianjaco
    Member
    Posted 1 year ago #

    There got to be something wrong with the "pages" filter.. Dont know what, if you get login could you take a look?

  7. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    What is it exactly what you're trying? Looking at your messages it seems you're trying to show up a widget. I guess when you're saying it's not working the widget doesn't show up. Does it show up when you set the widget to static (aka no DW rules)? Is the front page the only page where it goes wrong? Or are there other pages going wrong as well?

  8. stianjaco
    Member
    Posted 1 year ago #

    The scenario:
    I have a slideshow-plugin that should only be visible on the frontpage (without editing template files)
    The frontpage is a static wordpress page.

    When no rules set (aka no DW rules) the widgets is visible on all pages, posts and categories.
    When I select only the frontpage under "pages" (Checked the "Set all options to NO" first)
    it don't show up anywhere.
    When I select every page under "pages" except the frontpage and set the "Show widget default on static pages?" to YES it show up on every page.. (Including the frontpage)

  9. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, apparently the ID of the page (44) is not received by DW. Probably another ID or no ID at all. Are there custom queries running on that page? If so, try to add a wp_reset_query() just before the sidebar is called.

  10. stianjaco
    Member
    Posted 1 year ago #

    Did't not help, here is my code now:

    wp_reset_query();
    echo get_the_ID(); // Just to check if we have the ID (this case 44)
    if( is_active_sidebar( 'before-content') ) {
       echo "<div id=\"before-content\">\n";
       dynamic_sidebar( 'before-content' );
       echo "</div>";
    }

    The ID shows, but if the widget is dynamic and I have only one widget in the "before-content". The is_active_sidebar returns false. The filter is set up to show only on the page with the ID 44

  11. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Great, you know PHP.
    Can you check the following?

    Where DW thinks you are: $DW->whereami
    See if postID is available: $post->ID

    WhereAmI should return 'page' or 'home'. And the PostID should return 44.
    When WhereAmI reports 'home'. What is the get_option('page_for_posts') ?

  12. stianjaco
    Member
    Posted 1 year ago #

    OK, $post->ID returns 44, $DW->whereami returns nothing, and the entire $DW object return NULL.
    get_option('page_for_posts') returns "0"

  13. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Can you try a global $DW; and the try again to read the $DW->whereami ?

  14. stianjaco
    Member
    Posted 1 year ago #

    Already did, when I saw that the $DW returned NULL. :)
    Now I get:
    get_the_ID(): 32
    $DW->whereami: page
    page_for_posts: 0
    $post->ID: 32

    But not the widget..

  15. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Just to be sure: You also moved the widget rule to ID 32?

    When that's the case I really don't see why DW would refuse to display the widget. All information is there what DW uses to determine which rule to follow. Then I'd like to put DW into debugging mode and hopefully that shows where it goes wrong.

  16. stianjaco
    Member
    Posted 1 year ago #

    Yes, Widgetrule is set on page 32 :)
    Thought I would try it on another page just to be shure.

    When I use the "old method", is_active_sidebar( 'before-content') returns true,
    but dynamic_sidebar( 'before-content' ) returns nothing.

  17. stianjaco
    Member
    Posted 1 year ago #

    When I run var_dump($DW) i found something interesting.
    The Widget is registered as "responsive-slider-3" (The responsive-slider-2 is not dynamic)

    But In the dump "responsive-slider-2" has the ID of responisive-slider-3

    ["responsive-slider-2"]=>
        array(7) {
          ["name"]=>
          string(20) "Responsive Slideshow"
          ["id"]=>
          string(19) "responsive-slider-2"
          ["callback"]=>
          array(2) {
            [0]=>
            object(Responsive_Slider)#1829 (8) {
              ["id_base"]=>
              string(17) "responsive-slider"
              ["name"]=>
              string(20) "Responsive Slideshow"
              ["widget_options"]=>
              array(2) {
                ["classname"]=>
                string(23) "widget-responsiveslider"
                ["description"]=>
                string(31) "Responsivt slideshow av innlegg"
              }
              ["control_options"]=>
              array(1) {
                ["id_base"]=>
                string(17) "responsive-slider"
              }
              ["number"]=>
              int(3)
              ["id"]=>
              string(19) "responsive-slider-3"
              ["updated"]=>
              bool(false)
              ["option_name"]=>
              string(24) "widget_responsive-slider"
            }
            [1]=>
            string(13) "form_callback"
          }
          ["params"]=>
          array(1) {
            [0]=>
            array(1) {
              ["number"]=>
              int(2)
            }
          }
          ["width"]=>
          int(250)
          ["height"]=>
          int(200)
          ["id_base"]=>
          string(17) "responsive-slider"
        }
  18. stianjaco
    Member
    Posted 1 year ago #

    Full debug file:

    Dynamic Widgets INIT
    
    Dynamic Widgets v1.5.3 by QURL - http://www.qurl.nl
    WPML language:
    Overrulers registered: browser, date, day, week, role, tpl, url, wpml
    UserAgent: chrome
    Today it is Thursday (4), Week: 46
    User has role(s): administrator
    Page is page
    Path URL is /~sohavn/?page_id=32
    Prefix is /~sohavn
    Worker START
    WhereAmI = page
    Template = page.php
    WPML language:
    Q: SELECT widget_id, maintype, name, value FROM wp_dynamic_widgets
                      WHERE widget_id LIKE 'responsive-slider-2'
                        AND (maintype LIKE 'page%' OR maintype IN ('browser', 'date', 'day', 'week', 'role', 'tpl', 'url', 'wpml')) ORDER BY maintype, name
    Number of rules to check for widget responsive-slider-2: 28
    Default for responsive-slider-2 set to TRUE (rule D3)
    Default for responsive-slider-2 set to TRUE (rule D3)
    ID = 32
    WPML ObjectID: 0
    Q: SELECT widget_id, maintype, name, value FROM wp_dynamic_widgets
                      WHERE widget_id LIKE 'black-studio-tinymce-2'
                        AND (maintype LIKE 'page%' OR maintype IN ('browser', 'date', 'day', 'week', 'role', 'tpl', 'url', 'wpml')) ORDER BY maintype, name
    Number of rules to check for widget black-studio-tinymce-2: 28
    Default for black-studio-tinymce-2 set to TRUE (rule D3)
    Default for black-studio-tinymce-2 set to TRUE (rule D3)
    ID = 32
    WPML ObjectID: 0
    Q: SELECT widget_id, maintype, name, value FROM wp_dynamic_widgets
                      WHERE widget_id LIKE 'responsive-slider-3'
                        AND (maintype LIKE 'page%' OR maintype IN ('browser', 'date', 'day', 'week', 'role', 'tpl', 'url', 'wpml')) ORDER BY maintype, name
    Number of rules to check for widget responsive-slider-3: 4
    Default for responsive-slider-3 set to FALSE (rule D2)
    Default for responsive-slider-3 set to FALSE (rule D2)
    ID = 32
    WPML ObjectID: 0
    Removed responsive-slider-3 from display, SID = before-content / WID = responsive-slider-3 / KID = 0
    Q: SELECT widget_id, maintype, name, value FROM wp_dynamic_widgets
                      WHERE widget_id LIKE 'black-studio-tinymce-7'
                        AND (maintype LIKE 'page%' OR maintype IN ('browser', 'date', 'day', 'week', 'role', 'tpl', 'url', 'wpml')) ORDER BY maintype, name
    Number of rules to check for widget black-studio-tinymce-7: 2
    Default for black-studio-tinymce-7 set to FALSE (rule D2)
    ID = 32
    WPML ObjectID: 0
    Removed black-studio-tinymc
  19. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    I think I found the problem. DW can't find the WPML language and therefor moves the ID to 0. For reliability it shouldn't do that actually.
    Question is now why it can't find the WPML language.

    I did saw another email notification for a question you have about the virtual domain. That has no influence. It's for the URL module.

  20. stianjaco
    Member
    Posted 1 year ago #

    Dude! You are awesome! Disabled the WPML plugin (for now) and It works flawlessly!

  21. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Great to read everything works now. :)
    I'm going to add a reliability workaround for WPML, to make sure it doesn't return 0.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.