WooCommerce Tabs [closed]

Yup, there’s a filter for it: woocommerce_settings_tabs_array: add_filter( ‘woocommerce_settings_tabs_array’, ‘wpse94969_settings_tabs_array’ ); function wpse94969_settings_tabs_array($tabs){ $tabs[‘catalog’] = __(‘Products’,’your_textdomain’); // or whatever you fancy return $tabs; } This will take care about the tab title itself: The word “Catalog” appears again in two field labels below though. To change these you can take advantage of the woocommerce_catalog_settings filter: … Read more

Custom post type isn’t working

One problem is that your ‘capability_type’ parameter ‘community’ doesn’t match your ‘capabilities’ array values. From the Codex: capability_type (string or array) (optional) The string to use to build the read, edit, and delete capabilities. May be passed as an array to allow for alternative plurals when using this argument as a base to construct the … Read more

Fatal Errors on pluggable.php

Don’t mess around with changing those files directly. It will break when that file gets changed in an update. Do this instead. add_filter( ‘wp_mail_from’, ‘override_mail_from_address’ ); add_filter( ‘wp_mail_from_name’, ‘override_mail_from_name’ ); function override_mail_from_address($email_address) { $from_array = explode(‘@’, $email_address); $from_address = $from_array[0]; $from_domain = $from_array[1]; if (strtolower($from_address) == ‘wordpress’) { $from_address = “myname”; /* Put the email … Read more

Order posts alphabetically: how to set order=asc in mysql query?

Why don’t you use WordPress get_posts? You can add the parameter orderby => ‘title’ as you want. $args = array( ‘posts_per_page’ => -1, ‘order’ => ‘ASC’, ‘orderby’ => ‘title’ ); $posts = get_posts( $args ); print_r($posts); If you want the sql you can just add ORDER BY post_title: SELECT * FROM $wpdb->posts WHERE post_type=”post” AND … Read more

Function naming convention

I almost used the same convention as @GhostToas but to me I usually use classes to minimize conflict. For internal or company project: class MyCompany_Classname {} For Client specific project: class ClientProject_Classname {} Using a class will absolutely help you avoid conflicts and thus, you can name your function using generic function names. Say for … Read more

Function that outputs second theme url

You can use two inbuilt functions to do this. switch_to_blog get_stylesheet_directory_uri You can use both in the following way to make a function out of it which would give you the url to the theme. Put the below in the functions.php file function wpse_get_theme_url( $blog_id = 1 ){ switch_to_blog( $blog_id ); $template_url = get_stylesheet_directory_uri(); restore_current_blog(); … Read more

What’s wrong with my use of plugin_url()?

function add_my_css_and_my_js_files(){ wp_enqueue_script(‘jquery-validate-min’, plugins_url(‘activate/jquery_validate_min.js’, __FILE__ ) ); } add_action(‘wp_enqueue_scripts’, “add_my_css_and_my_js_files”); You need to use the plugins_url() function (you are missing the s at the end of plugins). Reference the location of the script file with the relative path. Meaning the path should be activate/jquery_validate_min.js.