badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

Child Theme Function.php – syntax error

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #21601
    birgitta_roos
    Participant

    Hello,

    I would like to add a function.php to my child theme. But I get a syntax error.
    So I hope you can tell me where I’m doing something wrong. I really don’t know much about php. When I add the code at the bottom of the function.php of the theme I works fine. But when I try to make a function.php for the child theme I get the syntax error.

    I hope you can help me.

    Kind regards,
    Birgitta

    This is the code I added to the child theme function.php:

    <?php

    /**
    * interface-child: adding hatom data
    */

    //mod content
    function hatom_mod_post_content ($content) {
    if ( in_the_loop() && !is_page() ) {
    $content = ‘<span class=”entry-content”>’.$content.'</span>’;
    }
    return $content;
    }
    add_filter( ‘the_content’, ‘hatom_mod_post_content’);

    //add hatom data
    function add_mod_hatom_data($content) {
    $t = get_the_modified_time(‘F jS, Y’);
    $author = get_the_author();
    $title = get_the_title();
    if(is_single()) {
    $content .= ‘<div class=”hatom-extra”><span class=”entry-title”>’.$title.'</span> was last modified: <span class=”updated”> ‘.$t.'</span> by <span class=”author vcard”><span class=”fn”>’.$author.'</span></span></div>’;
    }
    return $content;
    }
    add_filter(‘the_content’, ‘add_mod_hatom_data’);
    }

    ?>

    #21609

    Hi birgitta_roos,
    Just add this below code

    //mod content
    function hatom_mod_post_content ($content) {
    if ( in_the_loop() && !is_page() ) {
    $content = '<span class=”entry-content”>'.$content.'</span>';
    }
    return $content;
    }
    add_filter( 'the_content', 'hatom_mod_post_content');
    
    //add hatom data
    function add_mod_hatom_data($content) {
    $t = get_the_modified_time('F jS, Y');
    $author = get_the_author();
    $title = get_the_title();
    if(is_single()) {
    $content .= '<div class=”hatom-extra”><span class=”entry-title”>'.$title.'</span> was last modified: <span class=”updated”> '.$t.'</span> by <span class=”author vcard”><span class=”fn”>'.$author.'</span></span></div>';
    }
    return $content;
    }
    add_filter('the_content', 'add_mod_hatom_data');

    Thank you!

    #21642
    birgitta_roos
    Participant

    Thank you!

    #21656

    You welcome birgitta_roos

    Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.