1
votes

I'm pretty new to web designing and very eager to learn! I am currently working on a wordpress theme I've purchased and found the error log in the FTP server and was wondering if this is something I should be worried about or not?

It says

"[09-Sep-2014 01:58:36] PHP Warning: Missing argument 1 for kage_get_list_services(), called in /home2/neteffec/public_html/temp/wp-content/themes/kage-pro/template-homepage.php on line 21 and defined in /home2/neteffec/public_html/temp/wp-content/themes/kage-pro/functions.php on line 428"

Please let me know if you need more information! Thanks!

-Jason

1
Most of the time, warnings are no big deal but I try my best to fix them. It mean in your function there's probably more than 1 argument and 1 is missing. Can you please post the codes related to line 21 in template-homepage.php and line 428 of functions.php? - John Guan
This is the home page php: > $services_testimonials = kage_get_list_services(); and this is the functions.php: > if ( ! function_exists( 'kage_get_list_services' ) ) : function > kage_get_list_services($n) { > global $wp_query; > $args = array( > 'post_type' => 'service', > 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => $n > ); $wp_query->query( $args ); > return new WP_Query( $args ); } - Jason Han

1 Answers

0
votes

That error message means that you did not pass in the required argument $n to the function kage_get_list_services. That's because your code is:

$services_testimonials = kage_get_list_services();

It should be:

//Pass whatever $n is supposed to be
$services_testimonials = kage_get_list_services( 13 );

The difference between required and non required arguments is if they have a default value. For example, you could change the function to be:

if ( ! function_exists( 'kage_get_list_services' ) )
{

    function kage_get_list_services($n = 10)
    { 
        global $wp_query;
        $args = array( 'post_type' => 'service', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => $n ); 
        $wp_query->query( $args ); 
        return new WP_Query( $args );
    }
}

In the above example, if you pass nothing, $n would be 10.