• Resolved spacegoat

    (@spacegoat)


    I’m using the twenty eleven theme on several sites. I wanted to and add the below. I got to looking and none of the twenty eleven sites have a functions.php.
    To add code below do I just make a functions.php file and then add code to it?

    Prevent Page Scroll When Clicking the More Link

    By default, clicking the .more-link anchor opens the web document and scrolls the page to section of the document containing the named anchor (#more-000). This section is where writers choose to place the <!–more–> tag within a post type.

    Users can prevent the scroll by filtering the content more link with a simple regular expression.

    function remove_more_link_scroll( $link ) {
    $link = preg_replace( ‘|#more-[0-9]+|’, ”, $link );
    return $link;
    }
    add_filter( ‘the_content_more_link’, ‘remove_more_link_scroll’ );
    Simply add the above code to the theme’s functions.php file and the named anchors are no more.

Viewing 6 replies - 1 through 6 (of 6 total)
  • wpismypuppet

    (@wordpressismypuppet)

    Twenty Eleven does have a functions.php file. However, you shouldn’t edit it directly. Instead, create a child theme and create your functions.php file there. This way, when Twenty Eleven is updated, you won’t lose your work.

    If you can’t find the functions.php file, I would suggest getting a fresh copy of the Twenty Eleven theme is installing it.

    Well, don’t do that without a full site backup…let’s assume someone already did the customization of a theme called twentyeleven.

    Thread Starter spacegoat

    (@spacegoat)

    I do backup of “full site” weekly and use child theme for all my sites.

    I have three site using Twenty Eleven and none of them have a functions.php file. I did not delete it.

    I checked the original install file and there is a functions.php file.

    What would happen if i upload functions.php file now?

    You may just create a file named functions.php with only the following and add your new functions/ customizations:

    <?php
    
    // add any new or customised functions here

    And upload the file to your Twenty Eleven Child Theme’s folder.

    Thread Starter spacegoat

    (@spacegoat)

    Thank you for the help.

    You are welcome! ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘twenty eleven theme has no functions.php file?’ is closed to new replies.