• Resolved snor512

    (@snor512)


    Here i am having problems: https://redspot.es/wp-admin/themes.php this:

    There has been a critical error on this website. Please check your site admin email inbox for instructions. If you continue to have problems, please try the support forums.

    Learn more about troubleshooting WordPress.

    When i have created a functions.php for the twenty twenty five child theme that i am writing and that has this content:

    <?php
    /**
    * Twenty Twenty-Five child functions and definitions.
    *
    * @link https://developer.wordpress.org/themes/basics/theme-functions/
    *
    * @package WordPress
    * @subpackage Twenty_Twenty_Five child
    * @since Twenty Twenty-Five 1.0
    */
    // Añadir la imagen destacada antes del extracto
    add_filter('the_excerpt''mostrar_imagen_destacada_en_extracto');
    function mostrar_imagen_destacada_en_extracto($excerpt) {
    if (has_post_thumbnail()) {
    $img = get_the_post_thumbnail(get_the_ID()'thumbnail');
    $excerpt = $img . $excerpt;
    }
    return $excerpt;
    }

    Where is the problem?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello, the code has 2 small issues. add_filter(‘the_excerpt”mostrar_imagen_destacada_en_extracto’); has missed a coma (,) in between parameters. And get_the_post_thumbnail(get_the_ID()’thumbnail’); has missed coma (,) in between arguments. Please fix them, and it should work.

    r1k0

    (@r1k0)

    Hey @snor512,

    Hope you are well.

    From the code you provided, you are missing a couple of commas between arguments. This is the likely cause of the “critical error.” Adding the commas in the code below will likely fix the issue.

    From: add_filter('the_excerpt''mostrar_imagen_destacada_en_extracto'); to add_filter('the_excerpt', 'mostrar_imagen_destacada_en_extracto');

    From: $img = get_the_post_thumbnail(get_the_ID()'thumbnail'); to $img = get_the_post_thumbnail(get_the_ID(), 'thumbnail');

    Give these a try and let us know how it goes.

    Best of luck

    Thread Starter snor512

    (@snor512)

    Yes, this it was! Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.