<?php
add_action('wp_head', function(){
    if(get_post_type() !== 'job') return;

    $loxo = new Loxo();
    echo '<script type="application/ld+json">';
    $loxo->generateJsonSchema(get_the_ID());
    echo '</script>';
});

add_filter('wpex_job_single_blocks', function ($blocks) {
    /*
    (
        [media] => media
        [title] => title
        [meta] => meta
        [post-series] => post-series
        [content] => content
        [page-links] => page-links
        [share] => share
        [comments] => comments
    )
     */
    $blocks = array();

    $blocks['content'] = function(){
        global $post;
        $loxo_settings_options = get_option( 'loxo_settings_option_name' ); // Array of All Options
        $form_shortcode = $loxo_settings_options['form_shortcode']; // API Username
        ?>
        <div class="job-content">
            <div class="first-column">
                <?php echo apply_filters('the_content', $post->post_content); ?>
				<?php //echo do_shortcode('[indeed-apply jobtitle="'.get_the_title().' #'.get_post_meta( get_the_ID(), "bullhorn_job_id", true ).'" emailapplicationto="resume@redsealrecruiting.com"]'); ?>
                <hr/>
                <?php echo do_shortcode( $form_shortcode );?>
                <?php //echo get_template_part('partials/social-share'); ?>
            </div>
            <div class="second-column">
                <?php dynamic_sidebar('sidebar'); ?>
            </div>
        </div>
        <?php
    };
    // $blocks['content'] = 'content';

    // Option 1: Add new block "advertisement" and create your cpt-single-advertisement.php file to add to your child theme
    // $blocks['advertisement'] = __('My Advertisement', 'total');

    // // Option 2: Total 4.0+ only
    // // Add new blocks with custom function output
    // // Below is an example with an anonymous function but you can use custom functions as well ;)
    // $blocks['custom_block'] = function () {

    //     echo 'my custom block';

    // };

    // // Remove the featured image from this post type
    // unset($blocks['media']);

    // Return blocks
    return $blocks;

});
