Help please, stuck on Syntax Error :(

Hi, have been scratching my head for a fair few hours on this.

Have tried using phpcodechecker website to narrow down the error yet, no joy.

The code is:

function dotty_features() {

register_nav_menu('headerMenuLocation', 'Header Menu Location');



add_action(‘after_setup_theme’, ‘dotty_features’);

function dotty_adjust_queries($query) {

$query->('posts_per_page', '1'); THIS LINE IS SHOWING AS THE ERROR


add_action(‘pre_get_posts’, ‘dotty_adjust_queries’);

Have run the script through phpcodechecker and shows no errors until that line:
$query->(‘posts_per_page’, ‘1’);

Tried removing spaces, double quotes and escaping slash…

You’re missing a method name before the ('posts_per_page')

$query->set('posts_per_page', '1');

1 Like

JimL one day I shall buy you a drink, thank you so much :grinning: Code sorted

Sponsor our Newsletter | Privacy Policy | Terms of Service