Add footer.php to WordPress child theme

You have wrong argument for the filter. The first argument of the add_filter is the filter you are hooking up to. In your case it’s the mesmerize_get_footer_copyright. The second argument is the Call back function that would run the filter is called. So change your add_filter to this add_filter(‘mesmerize_get_footer_copyright’, ‘change_copyrightText’, 10,1) ;

write in functions.php

I’m not sure why you don’t just insert the code in the single.php, or use Denis’s solution, but if you want to hook into the_content you can do so by putting the following in your functions.php file: function append_the_content($content) { $content .= ‘PUT YOUR FUNCTION HERE’; return $content; } add_filter(‘the_content’, ‘append_the_content’); This will add directly … Read more

How often is functions.php loaded?

Simple answer is once. As any other PHP file otherwise it would likely cause crash because of function redefinitions. More complex answer is there can be actually two different functions.php loading – one for parent theme and one for child theme. Tricky part here is that child theme’s loads before the parent’s, which can at … Read more

Display the number of user comments

Got some idea from here. User’s comments have posted <?php function commentCount() { global $wpdb; $count = $wpdb->get_var(‘SELECT COUNT(comment_ID) FROM ‘ . $wpdb-comments. ‘ WHERE comment_author_email = “‘ . get_comment_author_email() . ‘”‘); echo $count . ‘ comments’; } commentCount(); ?> I don’t have any idea for comments that user got from their posts. Might be … Read more

How to change featured content to a different tag in WordPress Twenty Fourteen?

The internal implementation details of that feature are of questionable sanity. If you take a look at said featured-content.php template you would see that it get posts from twentyfourteen_get_featured_posts() however the only thing that function has is twentyfourteen_get_featured_posts filter from quick look at which in peculiar fashion nothing is actually getting hooked because twentyfourteen_setup() declares … Read more

Reuse variable in hook callback

If you want to use a variable from a another context in a function, create a class: class CustomLog { private $debug_msg = “”; public function __construct( $msg ) { $this->debug_msg = $msg; } public function log() { error_log( $this->debug_msg, 0 ); } } add_action( ‘init’, [ new CustomLog( “Hi there!” ), ‘log’ ], 20 … Read more

Remove “says” from comments

Hope this is gonna help. Please try this snippet. Put it in your themes functions.php or you could it load it thorough a plugin or any other way- function the_dramatist_remove_says_from_comment( $translation, $text, $domain ) { //what text you want to have instead of ‘says’ in comments. For removing ‘says’ keep this blank $new_var=””; $translations = … Read more

Execute a shortcode when clicking on a image

It’s certainly possible but you’re probably looking at doing an ajax request on the image click which in turn executes the short code and returns the output. This involves three distinct steps, binding the ajax request to an action, executing the ajax request and handling the response, and actually writing the script that will process … Read more