Copyright info change in Theme Child PHP

You need to modify 2 functions not only 1 in your functions.php: /** * Function to display footer content. * * @since 1.1.24 * @access public */ //ADDED CHILD TO THE END OF THE NAME function hestia_the_footer_content_child() { /** * Array holding all registered footer widgets areas */ $hestia_footer_widgets_ids = array( ‘footer-one-widgets’, ‘footer-two-widgets’, ‘footer-three-widgets’ ); … Read more

Order get_users() by last login date. Is it possible?

First, you need to store the actual login date, because this is not stored by default. You can use this code to do that(use it in your functions.php) add_action(‘wp_login’,’user_last_login’, 0, 2); function user_last_login($login, $user) { $user = get_user_by(‘login’,$login); $now = time(); update_usermeta( $user->ID, ‘user_last_login’, $now ); } After that, you can use the meta field … Read more

How to use WordPress (PHP) functions in AngularJS partials files?

What works is calling WP’s Ajax endpoint. Note that it is not the address of your partial, but the fixed WP address for all AJAX calls wp_localize_script(‘handle’, ‘myLocalized’, array( ‘ajaxUrl’ => admin_url( ‘admin-ajax.php’ ) ) ); provides the endpoint adress in the JS object myLocalized. You send all requests to that page and refer to … Read more

Change ul class=”children” for wp_list_pages?

You can override this by supplying your on Walker Object when calling wp_list_pages, like this: <your-template>.php wp_list_pages(array( ‘title_li’ => null, ‘depth’ => 2, ‘child_of’ => 0, ‘walker’ => new My_Walker(), )); Instead of the default Walker_Page this will make wp_list_pages use your custom walker, My_Walker. The only difference we need here is to make your … Read more

Delete post revisions on post publish

I think a small plugin with the hook ‘publish_posts’ is enough. But I dont know about a core function to delete revisions and I use a query with WP functions. The source is untested, written only for this post. <?php /** * Plugin Name: WPSE71248 Delete Revisions on Publish Posts * Plugin URI: http://wordpress.stackexchange.com/questions/71248/ * … Read more

Add custom image sizes to media uploader

Invalid argument supplied for foreach means that the X in foreach X as … is not an array. You can prevent this error by type casting; add (array) before the argument in the foreach statement. This will turn your variable into an array, essentially. In your code, the change would be… foreach ( (array) $attach_meta[‘sizes’] … Read more

How do I add a custom post type to the Featured Content in twenty fourteen theme?

The twentyfourteen_get_featured_posts filter: It took some digging, to figure out how the twentyfourteen_get_featured_posts filter is used in the TwentyFourteen theme 😉 The featured content is fetched with: $featured_posts = twentyfourteen_get_featured_posts(); but this function is only this single line: return apply_filters( ‘twentyfourteen_get_featured_posts’, array() ); so where’s the meat? We find it in the Featured_Content class, starting … Read more

Add class to Categories Widget

Here is a little jQuery snippet I made that should do what you want it to do (this just works for the category widget): // JavaScript Document $j = jQuery.noConflict(); $j(document).ready(function(){ $j(‘li.cat-item-1’).parent().addClass(‘test’); }); If you wanted to do this to all widgets, well it depends on the parent element of the widgets. Let’s say there’s … Read more

How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?

You don’t want to unregister the script; that would make it unavailable to be enqueued. Rather, you want to dequeue the script. You have two choices: If you know the callback function through which wp_enqueue_script( ‘jquery’ ) is called, you can simply call remove_action( ‘wp_footer’, ‘callback_function_name’ ) More likely, you won’t know the callback function … Read more

Change destination author link

To only edit the link associated with authors, in the functions.php of your theme: add_filter( ‘author_link’, ‘new_author_link’, 10, 1 ); function new_author_link( $link ) { $link = ‘http://newlink.com/’; //set this however you wish return $link; //after you’ve set $link, return it to the filter } If you’re looking to do something like set each author’s … Read more