コード例 #1
0
function if_download_name_function($atts, $content)
{
    $atts = shortcode_atts(array('not' => 'no', 'id' => '', 'is' => '', 'is_sensitive' => '', 'equals' => '', 'greater' => '', 'less' => '', 'search' => '', 'search_sensitive' => ''), $atts, 'if_download_name');
    if ($atts['id'] != '') {
        $id = $atts['id'];
    } else {
        $id = get_the_id();
    }
    ob_start();
    $name = get_the_title($id);
    $str_length = strlen($name);
    if ($atts['not'] == 'yes' || $atts['not'] == 1) {
        if (eval_condition($str_length, $atts['equals'], $atts['greater'], $atts['less']) && is_equals($name, $atts['is']) && is_equals_sensitive($name, $atts['is_sensitive']) && is_present($name, $atts['search']) && is_present_sensitive($name, $atts['search_sensitive'])) {
            echo '';
        } else {
            echo do_shortcode($content);
        }
    } else {
        if (eval_condition($str_length, $atts['equals'], $atts['greater'], $atts['less']) && is_equals($name, $atts['is']) && is_equals_sensitive($name, $atts['is_sensitive']) && is_present($name, $atts['search']) && is_present_sensitive($name, $atts['search_sensitive'])) {
            echo do_shortcode($content);
        } else {
            echo '';
        }
    }
    return ob_get_clean();
}
コード例 #2
0
function if_download_description_function($atts, $content)
{
    $atts = shortcode_atts(array('not' => 'no', 'id' => '', 'is' => '', 'is_sensitive' => '', 'equals' => '', 'greater' => '', 'less' => '', 'search' => '', 'search_sensitive' => ''), $atts, 'if_download_description');
    if ($atts['id'] != '') {
        $post = get_post($atts['id']);
        $description = $post->post_content;
    } else {
        $description = get_the_content();
    }
    $str_length = strlen($description);
    ob_start();
    if ($atts['not'] == 'yes' || $atts['not'] == 1) {
        if (eval_condition($str_length, $atts['equals'], $atts['greater'], $atts['less']) && is_equals($description, $atts['is']) && is_equals_sensitive($description, $atts['is_sensitive']) && is_present($description, $atts['search']) && is_present_sensitive($description, $atts['search_sensitive'])) {
            echo '';
        } else {
            echo do_shortcode($content);
        }
    } else {
        if (eval_condition($str_length, $atts['equals'], $atts['greater'], $atts['less']) && is_equals($description, $atts['is']) && is_equals_sensitive($description, $atts['is_sensitive']) && is_present($description, $atts['search']) && is_present_sensitive($description, $atts['search_sensitive'])) {
            echo do_shortcode($content);
        } else {
            echo '';
        }
    }
    return ob_get_clean();
}