• Resolved resunoiz

    (@resunoiz)


    Hi, I’d like to make some changes to the “More projects” part of the single portfolio project. But putting tempalte-tags.php in child theme (in main child folder, and in “inc” folder too) does nothing. Why?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter resunoiz

    (@resunoiz)

    no one?

    tried re-declaring it on child functions.php but obviously a previously declared function causes white screen and error.
    any suggestion, except NON upgrading theme in the future? :/

    make some changes to the “More projects” part

    the corresponding function is ‘pluggable’ so re-declaring it in the child theme should make no problems;
    https://codex.wordpress.org/Pluggable_Functions

    the error might have come from something else.

    what exact code are you trying to use in functions.php of your child theme?

    try and enable DEBUG to get to see the error message(s) http://codex.wordpress.org/Debugging_in_WordPress

    Thread Starter resunoiz

    (@resunoiz)

    here’s my child functions.php:
    <?php // Opening PHP tag – nothing should be before this, not even whitespace

    add_filter( “the_excerpt”, “add_class_to_excerpt” );
    function add_class_to_excerpt( $excerpt ) {
    return str_replace(‘<p’, ‘<p class=”entry-title”‘, $excerpt);
    }

    (triyng to include the template-tags)
    include( get_stylesheet_directory() . ‘/inc/template-tags.php’ );

    and here’s the error i get:

    Fatal error: Cannot redeclare espied_categorized_blog() (previously declared in D:\Inetpub\webs\dftnit\wordpress\wp-content\themes\dftn\inc\template-tags.php:153) in D:\Inetpub\webs\dftnit\wordpress\wp-content\themes\espied\inc\template-tags.php on line 173

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Are these bits inside your child theme functions.php file:

    (stylesheet)
    (excerpt funtuonality)
    (triyng to include the tempalte-tags)

    ??

    Thread Starter resunoiz

    (@resunoiz)

    nope, only to explain! 😀

    actually the functions.php is like this(still using @import in css, because the other method removes my post excrpts, and I don’t know why):

    <?php // Opening PHP tag – nothing should be before this, not even whitespace

    add_filter( “the_excerpt”, “add_class_to_excerpt” );
    function add_class_to_excerpt( $excerpt ) {
    return str_replace(‘<p’, ‘<p class=”entry-title”‘, $excerpt);
    }

    Thread Starter resunoiz

    (@resunoiz)

    don’t include the whole template-tags.php;
    as not all functions in that template are pluggable, you will get the error.

    only add those pluggable functions to functions.php of the child theme (just those which you want to change) and edit them there.

    Thread Starter resunoiz

    (@resunoiz)

    how to add them singularly?
    and how to understand which are pluggable?

    Thread Starter resunoiz

    (@resunoiz)

    SOLVED, readed about how to include pluggable functions..and understood it! thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘template-tags in child theme doesn't work?’ is closed to new replies.