How to Style Individual Categories Differently in WordPress

Do you want to style categories differently in WordPress? Most WordPress themes use the same style for all category archive pages. However, if you run a content rich website, then you can style each category differently to maximize their potential. In this article, we will show you how to easily style categories differently in WordPress.

How to style categories differently in WordPress

Why Style Categories Differently in WordPress?

As we said earlier, most WordPress themes use the same template for each category archive page. That’s because theme developers don’t know how you will be using the categories on your website and what those categories will be.

However, if you are running a content rich site, then changing the layout of a category archive page can have a dramatic impact on how users engage with the content on that page.

For example, if you run a news or magazine site, then you can have local ads displayed on the local news category. You can show weather information, show most popular stories in that category, and so on.

Having said that, let’s see how to easily style individual categories differently in WordPress.

Styling Individual Categories Differently in WordPress

There are multiple ways to style categories in WordPress. We will show you two different methods to style categories, and you can choose the one that best suits your needs and skill level.

Using Single Category Template in WordPress Theme

WordPress themes follow a standard template hierarchy. Depending on a template file name, WordPress can automatically pick the right template to display a page.

For example, it looks for category.php file to display category archive pages.

WordPress also allows you to create templates for individual categories as well. Let’s suppose you want to style the ‘Apple’ category differently. You can do that by adding a new template file to your theme and naming it category-apple.php.

Connect to your WordPress site using an FTP client and then go to /wp-content/themes/your-current-theme/ folder and create a new file category-apple.php. Don’t forget to replace apple with your own category name.

Creating a template for individual category in your WordPress theme

You can use your theme’s category.php file as a starting point. Simply edit and copy all of its content. Now edit your newly created category-apple.php file and paste the code inside it.

After that you can start making changes to your individual category template. You can create and use a different sidebar for this category, make it a full-width page, add a welcome message, or anything else you want.

Style Individual Categories in WordPress Using CSS

WordPress automatically adds CSS classes to different elements throughout your website. These include both the body class and the post class.

For example, if you view a category archive page and then use the Inspect Tool, you will notice category and category-name CSS classes in the body tag.

Category class added to body element by WordPress

You can use this CSS class to style each individual category differently by adding custom CSS.

Here is some example CSS that you can use as a starting point.

body.category-apple { background-color:#EEE;
background:url("http://example.com/wp-content/uploads/2017/background.jpg") no-repeat fixed;
color:#FFFFFF;
}
.category-apple .site { background:#232323; }
.category-apple a { color:#CCCCCC; } 

Don’t forget to change the category name in the CSS class with your own category name.

Changing category style using CSS

We hope this article helped you learn how to style categories differently in WordPress. You may also want to see our list of most wanted category hacks and plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Arctic Climate Change Study Canceled Due to Climate Change

This story originally appeared on Newsweek and is part of the Climate Desk collaboration.

The Canadian research icebreaker CCGS Amundsen, an Arctic expedition vessel, will not be venturing north for its planned trip this year. The highly anticipated voyage aimed to monitor and understand the effects of climate change on Arctic marine and coastal ecosystems. But due to warming temperatures, Arctic sea ice is unexpectedly in motion, making the trip far too dangerous for the Amundsen and the scientists it would be carrying. In other words, the climate change study has been rendered unsafe by climate change.

The project, known as the Hudson Bay System Study (BaySys), involves 40 scientists from five Canadian universities and was supported by $15 million over four years. A partnership between the scientists, led by the University of Manitoba, and the Canadian Coast Guard has been facilitating such climate change studies for nearly 15 years. The Amundsen is equipped with 65 scientific systems, 22 onboard and portable laboratories and a plethora of instruments that have been allowing researchers to study sediment, ocean ecosystems from just below the ice to just above the seafloor, the ice, the snow and the atmosphere.

The planned 2017 expedition was scheduled to depart six days early due to severe ice conditions in the Strait of Bell Isle, along the northeast coast of Newfoundland. The team was to carry out crucial operations in that area before starting their scientific program.

But the researchers, led by David Barber, expedition chief scientist and BaySys scientific lead, soon realized the trip was impossible. A southward motion of hazardous Arctic sea ice would prevent the Amundsen from reaching its destination in time to conduct the planned studies.

Barber said the severe ice conditions in the area are the result of climate change. Warming temperatures have reduced both the extent and thickness of the ice and increased its mobility. “Ice conditions are likely to become more variable, and severe conditions such as these will occur more often,” Barber said in a statement.

“Considering the severe ice conditions and the increasing demand for search-and-rescue operations and ice escort, we decided to cancel the BaySys mission,” said Barber.

Other portions of the 2017 Amundsen expedition will continue. Specifically, a planned oceanographic study and a Nunavik Inuit Health Survey are on schedule. The team also hopes to resume the BaySys program in 2018.

“The research of our scientists clearly indicate that climate change is not something that is going to happen in the future—it is already here,” a University of Manitoba statement announcing the cancelation stated.

‘The Handmaid’s Tale’ Recap, Episode 10: Dystopia Ain’t great at Happy Endings

In a dystopia, there are not any happy endings. Despite exactly what June claims or thinks, life won’t ever go back to how it had been. Moira can’t erase the evenings of ritual rape. Janine can’t restore a person’s eye the Republic of Gilead took from the woman. June can’t be here on her daughter’s childhood.

But providing there’s opposition, there’s hope. If the handmaids first arrived towards Rachel and Leah Center for training, they shared a look of terror to them, a appearance June (Elisabeth Moss) had never seen in actual life. But by The Handmaid’s Tale season finale, June, armed by having a package the Mayday Resistance, is currently longer afraid. “They should not have provided united states uniforms if they didn’t desire us become an military,” she believes, striding down snowy Boston roads with her fellow red-dressed soldiers.

Related Tales

  • Charley Locke

    Handmaid’s Tale: Either You Break the principles, or They Break You

  • Charley Locke

    Handmaid’s Tale: Oops, we developed a Sexist Tyranny and Now i need to are now living in It

  • Charley Locke

    Handmaid’s Tale: Be Sure You Escape the Dystopia Before It’s Too Late

Gilead’s leaders, though, won’t drop without a fight—an unsightly one. After June hides the secret package behind a tub at her Commander’s house, their spouse Serena Joy (Yvonne Strahovski) strikes the lady across the face, knocking June towards the floor. “I trusted you,” she states. “You might have kept me with one thing.” Mrs. Waterford has discovered June’s illicit brothel trips along with her spouse, betraying the strict roles associated with the republic. After bloodying the woman face, Serena Joy hands the lady a maternity test: She must know that the nights aided by the Commander, the affair between June and Nick she helped orchestrate, have at least resulted in an infant. For Serena Joy—and the regime—that’s the entire point of June’s existence.

Also it’s worked: June is expecting. Instantly, things change. Serena Joy does not damage the lady. Rita hugs the lady and prepares her a particular breakfast. When June tells Nick (Max Minghella), the presumed dad, we come across a uncommon minute of intimacy, as he touches the woman belly, holds her hand, and leans into her neck. Rape and misogyny didn’t prompt him to combat the regime, but personal stakes—the possibility for his or her own child—do. They could be a family. They might escape.

Serena Joy senses their private hope, and contains a plan to squash it. She escorts June as a car, locks the doors behind the girl, and takes the girl up to a nearby home. June is left in car while Serena Joy walks up and sits on steps of the property having young girl wearing pink: June’s daughter, Hannah. June pleads aided by the motorist to be discrete, pounds on the screen, throws herself against the vehicle home, to no avail. “As long as my infant is safe, therefore is yours,” Serena Joy informs her, making certain June, the vessel carrying the baby she wants, stays compliant. Serena Joy may feel June has rendered her powerless in her wedding, but she constantly discovers ways to remind her handmaid that is responsible. “You are deranged, you’re fucking wicked, you know that?” says June, spitting the language on Commander’s spouse through the window. “You are a goddamn motherfucking monster.” A monster who can utilize Hannah’s life as security. June asks the Commander to guard her daughter, but are no guarantees. She’s caught.

Rape and misogyny didn’t prompt Nick to combat the regime, but individual stakes—the chance for his own child—do.

But Moira (Samira Wiley) isn’t. She finally managed to make it out of Gilead after taking a man’s clothing at shiv-point and driving faraway from the brothel Jezebel’s. She makes it to Ontario and it is brought to a federal government center, where we finally see the mundane bureaucracy of survivors. A person provides Moira a refugee ID card, a prepaid mobile phone, a bag of clothes, a health care insurance card. (Oh, Canada.) Then, she’s free to do as she wants: to read, to shower, to get food. The caseworker tells a dumbfounded Moira, “it’s totally up to you.” Entirely alone and unmoored, she wanders out of the office discover Luke (O-T Fagbenle), the lady best friend’s spouse, awaiting her. “You’re on my list,” says Luke. It cann’t make a difference when they fought a lifetime ago—they’re family.

After Serena Joy confronts him about their event with June, the Commander tries to make amends. Soon, Offred/June will likely to be gone, and also the three of them—Serena, Fred, and the baby—will have the ability to take up a brand new family members. When the handmaid has served the woman purpose, she’ll disappear completely from their lives.

Except stealing someone’s infant isn’t quite very easy. After he made promises to his handmaid Janine they could run away together, Commander Putnam (Stephen Kunken) can’t leave his sin before. He faces a tribunal of peers, and thanks to their wife’s plea he get the harshest possible punishment, he loses a hand for his affair. The spouses still hold some energy, even if it is only vindictive.

June is headed for either punishment or escape; either way, she’s making.

But Janine (Madeline Brewer), the transgressive handmaid, suffers a worse fate: As soon as the other handmaids are summoned up to a Salvaging, it’s no not known guy they’re told to stone to death, but among their. For once, we come across the internal struggle of Aunt Lydia (Ann Dowd), the girl who trained and subjugated these women. “My unique girls,” she claims, searching across a sea of red dresses and white bonnets. “So stunning.” However the punishment for endangering a young child is death by stoning, and so one of her special girls must perish. She blows the whistle.

But the handmaids rally and refuse to murder Janine. Ofglen (Tattiawna Jones), the most stalwart believer in Gilead, shouts out this is insane, and gets hit because of the muzzle of a weapon. The remainder handmaids stay alone, holding their stones. June appears up, drops her rock, and states, “I’m sorry, Aunt Lydia.” Others handmaids follow suit. It’s an work of rebellion, couched in submissive apology. Aunt Lydia is confused, upset, irate. “There will soon be consequences, believe me,” she informs the handmaids. But also for now, they’ve spared the life span of one of these own.

As June sits by her screen, awaiting punishment for sparing living of the woman buddy, she seems relaxed. “I should really be terrified, but personally i think serene,” she thinks. “There’s a kind of hope, it seems, even in futility.” A black colored automobile brings up, and prior to the Eyes come to take the woman away, Nick tells the girl, “just go, trust in me.” Surprising no body, he finally views the worth in bucking the machine whenever his own youngster is involved. June walks past the bewildered Waterfords and in to the automobile. “And therefore I step up, to the darkness within—or else the light,” she believes. She’s headed for either punishment or escape; in either case, she’s making.

Margaret Atwood’s Handmaid’s Tale novel ends Offred’s story here. In an additional chapter, a teacher of Gileadean Studies dissects her journal for facts, but cannot find documents regarding the rest of the woman life. The very first period expanded somewhat through the guide, through tales of Moira, Janine, and Luke, and Season 2 is going to do equivalent. “The world has escaped from guide, and has now taken on a new way life of its own,” claims writer Atwood, who’ll continue steadily to work closely with show creator Bruce Miller in the second season. The Handmaid’s Tale escaped Atwood’s imagination as a result of Hulu—as for June’s escape, fans will need to keep viewing to discover.

How WordPress really works Behind the Scenes (Infographic)

maybe you have wondered exactly how WordPress is proven to work behind the scenes? For some users, this indicates easy because you type a Address plus web page lots in few seconds, but there is a great deal that happens behind the scenes. Inside guide, we will walk you through exactly how WordPress really works behind the scenes, and now we have developed a straightforward to follow along with infographic aswell.

How WordPress Functions Behind the Scenes

Why You Should Understand How WordPress Works?

WordPress can be an available source software, which means any one can learn its rule and write their very own apps (plugins) and templates (themes) because of it.

Learning just how WordPress works and how are you affected behind the scenes can help you know very well what you are able to do with it. You are able to learn about increasing WordPress performance and write better rule for your own tasks.

This guide will walk you through the entire procedure detail by detail. We will begin with when a individual requests a full page and end whenever that web page is fully loaded.

Prepared? Let’s get going.

Simply click to see the Behind the Scenes WordPress Infographic

You’ll be able to follow our written tutorial below for lots more details.

1. Load wp-config.php File

The wp-config.php could be the WordPress setup file. It sets worldwide factors for the WordPress website possesses your WordPress database information. This is actually the first file WordPress lots for obvious reasons. Find out more about wp-config.php file and exactly how to modify it.

2. Setup Standard Constants

After loading wp-config.php file, WordPress will proceed to set default constants. This consists of information like default WordPress upload location, maximum file sizes, along with other default constants set in wp-config.php file.

3. Load advanced-cache.php File

If advanced-cache.php file exists on your own site, then WordPress will load it next. This file will act as a drop-in file and it is employed by several popular plugins particularly WordPress caching plugins. In case the website is by using this file, then you’ll definitely view a new product regarding plugins screen called Drop-ins.

advanced-cache.php file showing up as drop-in

4. Load wp-content/db.php File

WordPress enables designers to create their own database abstraction levels and load them in a db.php file placed within the wp-content folder. It’s popular by WordPress caching plugins to improve database performance. If the website has this file present, then WordPress will load it.

5. Connect MySQL and choose Database

WordPress are in possession of sufficient information to proceed further. It’s going to proceed to connect to the MySQL server and select the database.

If WordPress struggles to connect to the database, then you will start to see the “Error establishing database connection” error and WordPress will quit right here.

If everything works fine, then it’ll move on to next actions.

6. Load object-cache.php or wp-includes/cache.php File

WordPress will now try to find object-cache.php file. If it cann’t occur, then WordPress will move on to load wp-includes/cache.php file.

7. Load wp-content/sunrise.php File

If it is a multisite system, then WordPress will now search for sunrise.php file if it exists in wp-content folder.

8. Load Localization Library

WordPress will now load l10n.php library in wp-includes folder. This file loads WordPress localization system, lots translations, sets locales, etc. See our guide on how to utilize WordPress in other languages.

9. Load Multisite Plugins

In case it is a multisite community, then WordPress will now load the multisite plugins. Find out about just how plugins work on WordPress multisite community.

system activated plugins

10. Do Action ‘muplugins_loaded’

The action muplugins_loaded has become run by WordPress. This step can be obtained only to network triggered plugins for a WordPress multisite.

11. Load Active Plugins

WordPress will now load all active plugins on the internet site. It can that by looking inside active_plugins entry within the choices dining table of one’s WordPress database. This allows WordPress to ignore plugins which are set up on your website although not triggered.

12. Load pluggable.php File

The pluggable.php file contains functions that may be redefined by WordPress plugins. WordPress will now see if the functions inside this file are already defined by another plugin. Otherwise, it will define those functions itself.

13. Do Action ‘plugins_loaded’

WordPress will now run the action ‘plugins_loaded’. It allows developers to hook their functions to run in the end active plugins have been loaded.

14. Load Rewrite Rules

WordPress will now load the rewrite guidelines. These rewrite rules help WordPress use Search Engine Optimization friendly URLs.

15. Instantiate $wp_query, $wp_rewrite, $wp

At this time WordPress loads these objects:

$wp_query: The international example that holds WP_Query class. It tells WordPress what content is requested in an average WordPress question format.

$wp_rewrite: The global example that holds your WP_Rewrite class. It includes your rewrite guidelines and functions which tell WordPress which Address to make use of to display the requested content.

$wp: The worldwide instance for the WP course containing functions which will parse your demand and perform the key question.

16. Do Action ‘setup_theme’

WordPress will now proceed to run ‘setup_theme’ action. This step runs before your WordPress theme is loaded.

17. Load Child Theme’s functions.php File

The functions.php file acts as plugin and is utilized in WordPress themes to include theme specific features to your site. If you use a child theme, then WordPress will now load your youngster theme’s functions.php file.

Otherwise, it will just load your active theme’s functions.php file.

18. Load Parent Theme’s functions.php File

If you use a kid theme, then WordPress will now load your moms and dad theme’s functions.php file.

19. Do Action ‘after_setup_theme’

This step runs after WordPress has setup the theme and loaded theme functions. It is the first action open to themes.

20. Setup Current User Object

Now, WordPress lots the existing user object. Permits WordPress to handle the demand prior to the user’s part and abilities.

21. Do Action ‘init’

WordPress has up to now packed all important information it requires. Now it fires the ‘init’ action.

This course of action permits designers to incorporate code which should be executed after WordPress has packed all earlier mentioned information.

22. Do Action ‘widget_init’

The widget_init action allows designers to register widgets and run code they needed seriously to run at the moment.

23. Run wp()

WordPress now calls wp() function that is located in wp-includes/functions.php file. It creates the WordPress question globals $wp, $wp_query, $wp_the_query after which calls $wp->main.

24. Parse Request

Now WordPress has all the information it needs to parse the consumer request. It starts by checking the rewrite guidelines to complement the user’s demand.

And then runs query adjustable filters, demand action hook, and delivers header demand.

25. Run Query

If no content matches the query, then WordPress will set is_404 variable.

Otherwise, WordPress goes onto load query factors.

It’ll then run WP_Query->get_posts().

Then, it fires DO_ACTION_REF_ARRAY ‘pre_get_posts’ action with WP_Query object.

WordPress will now run apply_filters to wash up question and run some final checks.

Now it fetches articles from database and applies articles_results and the_posts filters.

The question part ends with WordPress coming back the posts.

26. Do Action ‘template_redirect’

WordPress will now run the template_redirect action. This hook runs right before WordPress determines which template web page to load.

27. Load Feed Template

In the event that requested content is just a rss, then WordPress lots the feed template.

28. Load Template

WordPress will now try to find the template file predicated on WordPress template hierarchy. After that it loads the template which often has a WordPress loop.

29. Do Action ‘shutdown’

Right before ending all PHP execution, WordPress fires the last action called shutdown.

WordPress stops working here. It offers run the rule and generated user’s requested web page.

Now, your web web hosting server replies to user’s request by giving them the internet web page produced by WordPress. These pages contains HTML, CSS, and Javascript code, which tells user’s browser how exactly to display it on display screen.

Amazing isn’t it? All these things happen within milliseconds. If you work with one of these brilliant best WordPress web hosting services, then ideally your page will load in several moments.

Develop this short article helped you find out how WordPress works behind the scenes. You may even desire to see our step-by-step guide on how best to improve WordPress speed and performance for beginners.

If you liked this article, then please sign up for our YouTube Channel for WordPress video tutorials. There are also us on Twitter and Facebook.

How to Add Custom Meta Boxes in WordPress Posts and Post Types

Do you want to create custom meta boxes for your WordPress posts, pages, and custom post types? Custom meta boxes are commonly used to provide a better user interface for adding custom fields (meta data) into your content. In this article, we will explain what is a custom meta box, and how you can easily add custom meta boxes in WordPress posts and post types.

How to add custom meta boxes in WordPress posts

What is a Custom Meta Box in WordPress?

Custom meta box is a more user friendly interface to add custom fields (meta data) in your posts, pages, and other custom post types.

WordPress comes with an easy to use interface that helps you create content like posts and pages, or custom psot types.

Normally, each content type consists of the actual content and its metadata. Metadata is information related to that content like date and time, author name, title, and more. You can also add your own meta data by using custom fields.

Custom fields

However, adding metadata using the default custom fields box is not very intuitive. This is where custom meta boxes come in.

WordPress allows developers to create and add their own custom meta boxes on post edit screens. That’s how most popular plugins add different options on your post edit screens.

For example, the SEO title and meta description box inside Yoast SEO plugin is a custom meta box:

Category SEO Title and Meta description in Yoast SEO

Having said that, let’s see how you can easily add custom meta boxes in WordPress posts and post types.

Creating Custom Meta Boxes in WordPress

First, thing you need to do is install and activate the Advanced Custom Fields plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, the plugin adds a new menu item labeled ‘Custom Fields’ to your WordPress admin bar. Clicking on it will take you to the custom fields page.

This page will be empty since you haven’t created any custom fields yet. Go ahead and click on the ‘Add New’ button to continue.

Add new custom fields group

You will be taken to the ‘Add New Field Group’ page.

Here you need to provide a title for your field group. This title will be used as the title of your meta box.

After that you can start adding your fields. Simply click on the ‘+ Add Field’ button to add your first field.

Add your fist field

This will bring up the field settings form. First you need to provide a label for your field. This label will be displayed in your meta box before the field.

Creating a new field for your custom meta box

After that you need to select the field type. Advanced Custom Fields plugin allows you to choose from a whole range of options. This includes text, textarea, radio buttons, checkboxes, full WYSIWYG editor, images, and more.

Next, you need to provide field instructions. These instructions will tell users what to add into the field.

Below that, you will find other options for your field. You need to carefully review these options and adjust them to match your needs.

Field settings

Next, click on the close field button to collapse the field.

If you need to add more fields to your metabox, then click on the ‘+ Add Field’ button to add another field.

Close field and add another

Once you are done adding fields, you can scroll down to the location section. This is where you can define when and where you want your meta box to be displayed.

Location rules

Advanced Custom Fields comes with a handful of predefined rules for you to choose from. For example, you can select post types, post category, taxonomy, page parent, and more.

Next, comes the meta box options settings.

First you need to choose the order number. If you have multiple field groups defined for one location, then you can select the order number for them to be displayed. If you are unsure, then leave it as 0.

Meta box options

Next, you need to choose the meta box position on the page. You can choose to show it after the content, before the content, or in the right column.

Below that, you will need to choose a style for your meta box. You can choose it to be like all other WordPress meta boxes, or you can choose it to be seamless (without any meta box).

If you are unsure, then select Standard (WP Meta box) option.

Lastly, you will see a list of fields normally displayed on a post edit screen. If you want to hide a particular field on your post edit screen, then you can check it here. If you are not sure, then its best to leave them unchecked.

Once you are done, click on the publish button to make your field group live.

Publish your field group

Congratulations, you have successfully created your custom meta box for your WordPress post or post type.

Depending on your settings, you can now visit your post or post type to see your custom meta box in action.

Custom metabox preview

You can use this custom meta box to add meta data into your posts or post types. This data will be stored in your WordPress database when you save or publish the post.

Displaying Your Custom Meta Box Data in WordPress Theme

So far we have successfully created a custom meta box and displayed it on our post edit screen. The next step is to display the data stored in those fields on your WordPress theme.

First, you need to edit the custom field group you created earlier. On the ‘Edit Field Group’ page, you will see your custom fields, and their names.

Field names

You will need these fields names to display them on your website.

Advanced Custom Fields allows you to do that in two different ways.

First, you can use a shortcode to display a custom field into your post.

[acf field="article_byline"]

You can also display them by adding code into your WordPress theme files. If you haven’t done this before, then take a look at our beginner’s guide on how to copy and paste code in WordPress.

You will need to edit the theme file where you want to display the data from these fields. For example, single.php, content.php, page.php, and so on.

You will need to make sure that you add the code inside the WordPress loop. The easiest way to make sure that you are entering the code inside the loop is to look for a line in your code that looks like this:

<?php while ( have_posts() ) : the_post(); ?>

You can paste your code after this line and before the line that ends the loop:

<?php endwhile; // end of the loop. ?>

Your custom field code would look something like this:

<h2 class="article-byline"><?php the_field('article_byline'); ?></h2>

This code will display the data entered into the article byline field of our custom meta box.

Notice how we wrapped the code in a h2 heading with a CSS class. This will help us format and style the custom field later by adding custom CSS into our theme.

Here is another example:

<blockquote class="article-pullquote"> <?php the_field('article_pullquote'); ?> </blockquote> 

Don’t forget to replace the field names with your own field names.

You can now visit the post where you have already entered the data into your custom fields. You would be able to see your custom meta data displayed.

Custom fields displayed on a website

Advanced Custom Fields is a very powerful plugin with a lot of options. This tutorial only scratches the surface. If you need more help, then don’t forget to check out the plugin’s documentation on how to further extend it.

We hope this article helped you learn how to add custom meta boxes in WordPress posts and post types. You may also want to see our step by step guide on how to boost WordPress speed and performance for beginners.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.