Forums
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
What am I missing please
$cat_post = new WP_Query( array(
‘posts_per_page’ => 1,
‘category__in’ => array(2))
‘post_type’ => array(
‘post’,
‘custom1’,
‘custom2’,
‘custom3’
),
);
@fectio1 What is the error that it gives (and what line does it say)?
syntax error, unexpected T_CONSTANT_ENCAPSED_STRING Line 7 which is between
‘category__in’ => array(2))
‘post_type’ => array(
@fectio1 Try a comma after (2))?
Then I get syntax error, unexpected T_DOUBLE_ARROW on same line.
@ChristopherBurton thanks for your suggestions and looking at it. I think it might be that time I need to walk away for a bit.
@fectio1 If not a comma then a semi-colon. That would be my only advice.
Still throwing an error. Thanks @ChristopherBurton
@fectio1 Then try posting on http://stackoverflow.com. I think your code setup is the issue. Post back when they give you the answer.
`$cat_post = new WP_Query( array(
‘posts_per_page’ => 1,
‘category__in’ => array(2),
‘post_type’ => array(
‘post’,
‘custom1’,
‘custom2’,
‘custom3’
)
));`
$cat_post = new WP_Query( array(
‘posts_per_page’ => 1,
‘category__in’ => array(2),
‘post_type’ => array(
‘post’,
‘custom1’,
‘custom2’,
‘custom3’
)
));
@beeblebrox you are my hero for the next week :)
I don’t know why its throwing the end of this onto the next line… but here’s what’s going on:
‘category__in’ => array(2), // you had a ) that should have been a ,
‘custom3’ ), // this last comma (which I think is on the next line) actually needs to be a )
Thank you very much. I have been looking at this for 3 hours, Literally