• Hello, everyone. This is more like a philosophical question, sorry. πŸ˜‰

    I develop web apps for a while now, but I’m new into wordpress and CMS generally speaking.
    I like to keep code as simple and clean as I can, specially when I know that people will see and use it.

    So I was looking into the Gridz theme, that was realeased awhile ago in gnu 2 license.

    And I was shocked how BIG the functions.php was in this theme. For example I found this:

    /**
     * Returns a Read more link for excerpts
     */
    
    function gridz_continue_reading_link() {
        return '<a class="more-link" href="'.get_permalink().'">'.__('Read more...','gridz').'</a>';
    }

    I don’t understand WHY they need to create their own function when WordPress has one out of the box, something I TRY all the time not to do.
    They added so many unique functions that it’s hard to tweak the theme (child theme-wise).

    So can anyone explain me why they code like this? Are there any benefits?

Viewing 1 replies (of 1 total)
  • Hey Macros T !

    Welcome to the club πŸ™‚

    Ok that function gridz_continue_reading_link is used to customize the read more link text. If you check again the same file and prolly close to where that function is coded you will see sthg like

    add_filter( 'the_content_more_link', 'gridz_continue_reading_link ' );

    Here is more about it Customizing_the_Read_More

    and reading about Filters would make things clearer than having me explaining it here which may make things a bit long :p

    I hope this helps πŸ™‚

    Cheers !

Viewing 1 replies (of 1 total)
  • The topic ‘Why people add functions to call for functions that exist out of the box?’ is closed to new replies.