Exemplo n.º 1
0
function rum_post_cta_meta_box_init()
{
    // get activation status
    $activated = rum_post_cta_activation_check();
    if ($activated) {
        // add_meta_box( $id, $title, $callback, $page, $context, $priority, $callback_args )
        add_meta_box('rum_post-cta-meta-box', __('Post Call to Action', 'rum-post-cta-textdomain'), 'rum_post_cta_meta_box_callback', 'post', 'side', 'high');
    }
}
Exemplo n.º 2
0
function rum_post_cta_box($content)
{
    global $post;
    // get activation status
    $activated = rum_post_cta_activation_check();
    if ($activated) {
        // checks to make sure code executes only on single 'post' pages and inside of the main Loop
        if (is_singular('post') && is_main_query()) {
            // retrieve the custom meta box value
            $post_cta_id = get_post_meta($post->ID, 'rum_post_cta_id', true);
            // enqueue registered stylesheet
            wp_enqueue_style('rum-post-cta-styles');
            // only proceed if there is data in the meta field for storing the CTA data from the metabox
            if ($post_cta_id != '') {
                $rum_post_cta_box = rum_cta_box_html($post_cta_id);
                $content .= $rum_post_cta_box;
            }
        }
    }
    return $content;
}