• WP category as class name

    <?php if (is_single()) {
    global $post;
    $cat='';
    $cats = get_the_category($post->ID);
    foreach ( $cats as $c ) {
    $cat .= $c->category_nicename.' ';
    }
    } ?>

    Add the code above to the header.php file before the tag
    <body <?php body_class($cat); ?>>


  • WP shortcode to php output

    functions.php
    function jv($atts){
    $atts = shortcode_atts( array(
    'file' => ''
    ), $atts, 'akcija' );
    ob_start();
    include(ABSPATH.'wp-content/akcija/'.$atts['file'].'.php');
    $content = ob_get_clean();
    return $content;
    }
    add_shortcode('akcija', 'jv');