WordPress.org

Ready to get started?Download WordPress

Forums

View All Posts in Category Externally (4 posts)

  1. acondiff
    Member
    Posted 4 years ago #

    I want to view all the posts in a category on an external page in the same domain. I figured it out but I get an error message on the page that is displaying the content. How do I get rid of this error message. I am not too familiar with php but I am trying. Here is the code at the beginning of my page:

    <?php
    // Include WordPress
    define('WP_USE_THEMES', false);
    require('./wordpress/wp-blog-header.php');
    global $wp_query;
    query_posts(
    array_merge(
    array('cat' => 3),
    $wp_query->query
    )
    );
    ?>

    here is the code in the content box to display the content:

    <?php while (have_posts()): the_post(); ?>
    <h4><?php the_title(); ?></h4>
    <?php the_content(); ?>
    <?php endwhile; ?>

    here is the error message i get at the to of the page:

    Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /hermes/bosweb/web297/b2972/ipw.mcondiff/public_html/index.php on line 10

    Any help would be great!

    Thanks!
    Austin

  2. Mark / t31os
    Moderator
    Posted 4 years ago #

    Remove this part..

    $wp_query->query
  3. acondiff
    Member
    Posted 4 years ago #

    i did and now i cant see my page at all and i get this error:

    Parse error: syntax error, unexpected ')' in /hermes/bosweb/web297/b2972/ipw.mcondiff/public_html/index.php on line 10

  4. Mark / t31os
    Moderator
    Posted 4 years ago #

    Yes sorry, and remove the comma just before that..

    array('cat' => 3),
    $wp_query->query

    ..becomes..

    array('cat' => 3)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.