• Hi everyone,

    I have this line in my index.php for getting all the posts from a certain category:

    <?php query_posts('category_name=categoryname&posts_per_page=4'); ?>

    I have this in my home made theme options:

    // Ask for category on homepage
    array( "name" => "Category home:",
     "desc" => "Enter the name of the category you want to display on the home page",
     "id" => $shortname."_category_home",
     "type" => "text",
     "std" => ""),

    Now, I want the user to input the name of the category, and this should be filled in in the first line.
    I came up with this:

    <?php query_posts('category_name=echo $options['category_home']&posts_per_page=4'); ?>

    This gives me a syntax error, can someone help please?

    Thanks in advance !

Viewing 1 replies (of 1 total)
  • Thread Starter benwake

    (@benwake)

    I tried with this one, but no luck, he doesn’t apply the category (but applies the 4 posts and it removed the syntax error). Somebody? 🙂

    <?php query_posts('category_name='.$options['category_home'].'&posts_per_page=4'); ?>
Viewing 1 replies (of 1 total)

The topic ‘php query_posts syntax error (should be very easy:-)’ is closed to new replies.