Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Destroyed by syntax error

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #39995
    fectio1
    Member

    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’
    ),
    );

    #110712
    chrisburton
    Participant

    @fectio1 What is the error that it gives (and what line does it say)?

    #110713
    fectio1
    Member

    syntax error, unexpected T_CONSTANT_ENCAPSED_STRING Line 7 which is between

    #110714
    fectio1
    Member

    ‘category__in’ => array(2))
    ‘post_type’ => array(

    #110715
    chrisburton
    Participant

    @fectio1 Try a comma after (2))?

    #110716
    fectio1
    Member

    Then I get syntax error, unexpected T_DOUBLE_ARROW on same line.

    #110717
    fectio1
    Member

    @ChristopherBurton thanks for your suggestions and looking at it. I think it might be that time I need to walk away for a bit.

    #110718
    chrisburton
    Participant

    @fectio1 If not a comma then a semi-colon. That would be my only advice.

    #110719
    fectio1
    Member

    Still throwing an error. Thanks @ChristopherBurton

    #110720
    chrisburton
    Participant

    @fectio1 Then try posting on http://stackoverflow.com. I think your code setup is the issue. Post back when they give you the answer.

    #110721
    beeblebrox
    Participant

    `$cat_post = new WP_Query( array(
    ‘posts_per_page’ => 1,
    ‘category__in’ => array(2),
    ‘post_type’ => array(
    ‘post’,
    ‘custom1’,
    ‘custom2’,
    ‘custom3’
    )
    ));`

    #110722
    beeblebrox
    Participant

    $cat_post = new WP_Query( array(
    ‘posts_per_page’ => 1,
    ‘category__in’ => array(2),
    ‘post_type’ => array(
    ‘post’,
    ‘custom1’,
    ‘custom2’,
    ‘custom3’
    )
    ));

    #110723
    fectio1
    Member

    @beeblebrox you are my hero for the next week :)

    #110724
    beeblebrox
    Participant

    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 )

    #110725
    fectio1
    Member

    Thank you very much. I have been looking at this for 3 hours, Literally

Viewing 15 posts - 1 through 15 (of 18 total)
  • The forum ‘Back End’ is closed to new topics and replies.