• Skip to main content
  • Skip to primary sidebar

WordPress, Genesis Framework and Storefront customization tutorials

  • Archive
    • Free
    • Premium
  • Blog
  • About
  • Contact
  • Newsletter
  • Login
Home » PHP » Page 4

PHP

Add post category to body class


// =========================================================================
// ADD POST CATEGORY TO BODY CLASS
// =========================================================================
function add_category_to_body_class( $classes ) {
	if ( !is_single() )
	return $classes;
	$post_categories = get_the_category();
		foreach( $post_categories as $current_category ) {
			$classes[] = 'category-' . $current_category->slug;
		}
	return $classes;
	}
add_filter( 'body_class', 'add_category_to_body_class' );

Filed Under: Free Tagged With: PHP

Add text with function


//ADD TEXT VIA FUNCTION
add_filter( 'ultimatum_print_footer', 'add_barion_banner' );
function add_barion_banner( $barion_banner ) {
echo 'TESZT';
return $barion_banner;
}

Filed Under: Free Tagged With: PHP

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4

Primary Sidebar

Gabor Flamich

Hi! I'm Gabor.
I write tutorials on WordPress and WooCommerce.

MacBook

12 Essential Snippets for Genesis Developers

Subscribe to my Newsletter to view my basic collection of Genesis snippets that I use for my projects!

Sign Up for Free
  • Facebook
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube
UpdraftPlus Premium

Tags

ACF Ajax Analytics API Bootstrap Breadcrumb category CPT CSS fetch Genesis Google Maps Gutenberg HTML Isotope JavaScript jQuery loop Map Menu Parallax PHP SASS SEO SQL Storefront SVG tab tag manager tags Taxonomy Tool upsell Webpack Wholesale WooCommerce WordPress WPML

Disclosure: Some of the links in this site are affiliate links. I will be paid a commission if you use this link to make a purchase.

  • Privacy Policy / Terms of Service
© 2023 WP Flames - All Right Reserved