Search code examples
phpwordpressbuddypress

WordPress & BuddyPress Outputting PHP to page


I have a section of code inside a cusomtised BuddyPress widget (latest-articles.php) which is falling over on the => part and outputting everything after that to the screen. Here is the code section:

    $infohub_args = array(
    'post_type' => array('article','post'),
    'posts_per_page' => 8, 
    'order' => 'DESC', 
    'post_status' => 'publish'
);
$infohub_loop = new WP_Query($infohub_args);

This is what outputs to the screen instead of the widget contents:

array('article','post'), 'posts_per_page' => 8, 'order' => 'DESC', 'post_status' => 'publish' ); $infohub_loop = new WP_Query($infohub_args); */ $post_max = 8; $all_post = array(); $article_cat = get_terms( array( 'taxonomy' => 'articles', 'hide_empty' => true ) );

Basically everything after the ' => ' part is displayed on the screen.

Is this a PHP configuration or version issue?

This is on a Windows 10 / IIS 10 machine.


Solution

  • There you wont allows for short open tag <? (which is discouraged since it is only available if enabled using the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option).

    refer doc http://php.net/manual/en/language.basic-syntax.phptags.php