A few Macblaze.ca specific fixes

To get my Instagram posts to play nice with flex rather than floats I added

.category-instagram .post-content{
  display:flex;
  flex-wrap: wrap;
}

Fixed the Headings CSS

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

 

Ascending post order

macblazev v 0.75.9

Back when I posted about changing the order of certain categories and/or all of them. But for some reason the feature seems to be missing from MacblazeIV which reversed the order on all categories. So I needed to put it back in.

What I came up with is this. It goes in the category.php file after if ( have_posts() ) and allows me to specify which categories are sorted by ascending order and which are descending. This snippet also allows me to specify posts per page which I didn’t end up using but I left in here for posterity.

< Changes display order for certain categories >
        

    $thiscat =  get_query_var('cat'); 
        $catobject = get_category($thiscat); 
        $parentcat = $catobject->category_parent; 
        $slugname  = get_category($parentcat)->slug;

                if (in_array($slugname, array('cat-1', 'cat-2')) || is_category(array('cat-3','cat-4')) ) {
                    query_posts( $query_string."&orderby=date&order=ASC&posts_per_page=2" ); 
                }

It’s based on https://stackoverflow.com/questions/19961130/wordpress-how-to-get-parent-category-id and essentially finds the current category, finds the the id of the parent category then uses an if statement to check if that parent is one of the categories in the array. Then it checks to see if the current category is listed (without having a parent) as one that should also have an ascending order.

Parents and individual categories are listed by their slugs.

Right now the parents are: array('Trips Etc.') — so that all trips under that category read front to back — and the individual categories I want ascending are array('its-novel','recipes-of-yore').

All-in-all it works, but I need a more elegant solution.

Useful links for the future