WP-TopBar Selection Logic

WP-TopBar Plugin for WordPress has a robust selection logic. It allows you control what pages, categories, type of device or een if the user is logged in. The order of selection is as follows:

      1. First, a database query is executed to select:
        • All ENABLED TopBars AND
        • Have a have a Start Time prior to or equal to that moment in time AND
        • Have an End Time at or greater than that moment in time.

        The result of that query is an Array of all the valid TopBars.

      2. Next, we check the Home Page logic.
        • If we are on the Home Page
          • Option B (Never shows the TopBar on the Home Page regardless of any other criteria entered below and not other pages) is selected, then we stop checking and do not use that TopBar.
          • Option C (Conditionally shows the TopBar on the Home Page if the page matches the Page ID and/or Category criteria entered below), then go to Step 3.
        • If we are NOT on the Home Page
          • Option D ( Only shows the TopBar on the Home Page and not other pages) is selected, then we stop checking and do not use that TopBar.
          • Option A (Always shows the TopBar on the Home Page regardless of any other criteria entered below) is chosen, then go to Step 5  below.
             
      3. Now, we look at the Selection Criteria Logic options.
          • Option A. Checks only Page IDs (ignore Category ID criteria)
          • Option B. Checks only Category IDs (ignore Page ID criteria)
          • Option C. BOTH Page ID and Category ID must match the criteria entered for the TopBar to show
          • Option D. EITHER Page ID or Category ID must match the criteria entered for the TopBar to show

        For each of these, we extract the Page ID and Category IDs of the pageview and check whether to keep the TopBar or move on to the next one.

      4. Now, we check for Cookies.  If the TopBar has the Enable Cookies option set to On and the TopBar cannot be re-opened, then we look for  a cookie that matches the TopBar’s Cookie Value. If one exists, then we stop checking and do not use that TopBar.
         
      5. Now, we check to see what Device the user is using.
        • Option A. Mobile Devices shows the TopBar only for mobile devices.
        • Option B. non-Mobile Devices shows the TopBar only for other devices.
        • Option C. Always shows the TopBar for all devices

Only if the TopBar passes this last test, will it be a candidate to be shown.   The Plugin then builds the JavaScript to show the TopBar. See these pages for more details: