- This topic has 3 replies, 2 voices, and was last updated 10 years, 9 months ago by
Theme Horse Support Team.
-
AuthorPosts
-
February 4, 2015 at 10:06 pm #21601
birgitta_roos
ParticipantHello,
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,
BirgittaThis 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’);
}?>
February 5, 2015 at 6:03 am #21609Theme Horse Support Team
KeymasterHi 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!
February 5, 2015 at 10:14 pm #21642birgitta_roos
ParticipantThank you!
February 6, 2015 at 6:40 am #21656Theme Horse Support Team
KeymasterYou welcome birgitta_roos
Thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.
