shortcode doesnt work on excerpt

Question

my shortcodes doesnt seem on archive page excerpts.you can see an example excerpt:

https://unit-test-data.deniz-tasarim.site/2011/03/15/

here is related code with excerpt in my theme files:

archive.php:

<h3><?php the_title(); ?> </h3>
                            <p class="project-dp-one"><?php the_excerpt(); //html5wp_excerpt('html5wp_index'); // Build your custom callback length in functions.php ?></p>
                            <a class="btn btn-lg ulockd-btn-thm2" href="<?php the_permalink(); ?>"><?php _e( ' Read More', 'hekim' )?></a>

function.php:

function hekim_excerpt_lenght_number(){
    global $redux_demo;
    if (  is_numeric($redux_demo['text-excerpt-length'])==1 ) {
        add_filter( 'excerpt_length', function( $length ) {
            global $redux_demo;
            return $redux_demo['text-excerpt-length']; } );
    }
    else {
        add_filter( 'excerpt_length', function( $length ) { return 11; } );
    }
}
add_action( 'after_setup_theme', 'hekim_excerpt_lenght_number' );

// Custom Excerpts
/*-
function html5wp_index($length) // Create 20 Word Callback for Index page Excerpts, call using html5wp_excerpt('html5wp_index');
{
    return 2;
}

// Create 40 Word Callback for Custom Post Excerpts, call using html5wp_excerpt('html5wp_custom_post');
function html5wp_custom_post($length)
{
    return 40;
}
*/
// Create the Custom Excerpts callback
function html5wp_excerpt($length_callback = '', $more_callback = '')
{
    global $post;
    if (function_exists($length_callback)) {
        add_filter('excerpt_length', $length_callback);
    }
    if (function_exists($more_callback)) {
        add_filter('excerpt_more', $more_callback);
    }
    $output = get_the_excerpt();
    $output = apply_filters('wptexturize', $output);
    $output = apply_filters('convert_chars', $output);
    $output = '<p>' . $output . '</p>';
    echo esc_html_e( $output, 'hekim' );
}

add_filter('the_excerpt', 'shortcode_unautop'); // Remove auto <p> tags in Excerpt (Manual Excerpts only)
add_filter('the_excerpt', 'do_shortcode'); // Allows Shortcodes to be executed in Excerpt (Manual Excerpts only)


add_filter( 'get_the_excerpt', 'shortcode_unautop');
add_filter( 'get_the_excerpt', 'do_shortcode');
add_filter( 'get_the_excerpt', 'do_shortcode', 5 );

add_filter('excerpt_more', 'hekim_html5_blank_view_article'); // Add 'View Article' button instead of [...] for Excerpts



//remove_filter('the_excerpt', 'wpautop'); // Remove <p> tags from Excerpt altogether

how can I show shortcodes on excerpts?

0
Faruk riza 8 months 2020-11-30T06:10:20-05:00 0 Answers 13 views 0

Leave an answer

Browse
Browse