Redeclare function (override) [closed]
PHP cannot redeclare functions. You will need to use some other approach, like filters or similar.
PHP cannot redeclare functions. You will need to use some other approach, like filters or similar.
Add user contact methods using the user_contactmethods filter in your theme’s functions.php or via a plugin: User contact method entries are stored in the wp_usermeta table. The URL field is special; it’s stored in the user_url field in the wp_users table. // Add user contact methods add_filter( ‘user_contactmethods’,’wpse_user_contactmethods’, 10, 1 ); function wpse_user_contactmethods( $contact_methods ) … Read more
You can do this in two ways. If you want to keep it theme specific, edit your functions.php file with this code: add_action( ‘after_setup_theme’, ‘my_new_default_image_settings’ ); function my_new_default_image_settings() { update_option( ‘image_default_align’, ‘right’ ); update_option( ‘image_default_link_type’, ‘file’ ); } The other way to do it is more general, but also more rigid: Go to YOURSITE.COM/wp-admin/options.php Find … Read more
to have the good path to the file, try this : $array = file(plugin_dir_path(__FILE__) . “quotes.txt”);
You can use the $post global. Somewhere inside of a function, hooked in appropriately to the post-edit screen: // Globalize the $post variable global $post; // check to see that we are on a page, with a title “About Me” if ( ‘page’ == $post->post_type && ‘About Me’ == $post->post_title ) { // This is … Read more
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
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
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
The easiest way would be to look at the code of Si Contact Form (since it already does what you want) and use the same kind of system. Shortly, you’ll need methods to do the following: Create an XML (or other format) document of your theme options. Save/Export the XML document. Import the XML document … Read more
You’re reusing handles for the script and the styles. These need to be unique values (see WP Codex Reference) It should look something like this: wp_enqueue_script( ‘owlcarousel’, get_template_directory_uri() . ‘/inc/owl/owl.carousel.min.js’, array( ‘jquery’ ), false, true ); wp_enqueue_script( ‘owlcarousel-init’, get_template_directory_uri() . ‘/inc/owl/owl.carousel-init.js’, array( ‘jquery’ ), false, true ); wp_enqueue_style( ‘owlcarousel-style’, get_template_directory_uri() . ‘/inc/owl/owl.carousel.css’ ); wp_enqueue_style( ‘owlcarousel-theme’, … Read more