• I’ve run into a problem regarding the calendar and archive widget WordPress provides. Whenever, I click on say a date on the calendar, it no longer keeps the layout that it was intended to keep (centering the page for example). However, it works for all the other pages (e.g. single.php, tag, category, etc…)

    The link to the page with the intended layout is here. The page that is having the problem is here and it’s currently grabbing from archive.php.

    It’s grabbing the correct layout in terms of how it should be displayed, it’s just not centered for some odd reason like the other pages. I’m not exactly sure how to tackle this problem, and any suggestions would be greatly appreciated.

    If there’s more information required, please let me know.

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

    (@bbopbernard)

    I have found the problem here. I had to remove the body_class() from the header.php. However, theme check requires me to have body_class(). Is there a workaround to have both the page centered and the body_class()?

    Thanks.

    Thread Starter bbopbernard

    (@bbopbernard)

    Still haven’t found a solution, any ideas?

    Thread Starter bbopbernard

    (@bbopbernard)

    I’ve dug a little deeper. Is there a way to remove a single class from body_class()?

    EDIT: Figured it out. Add the following to your functions.php.

    function remove_a_body_class($wp_classes)
    {
        foreach($wp_classes as $key => $value)
        {
            if ($value == 'date')
            {
                unset($wp_classes[$key]);
            }
        }
    
        return $wp_classes;
    }
    add_filter('body_class', 'remove_a_body_class', 20, 2);

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Clicking on WordPress calendar/archive widget breaks layout’ is closed to new replies.