Tagged: , ,

Viewing 2 reply threads
  • Author
    Posts
    • #1891
      civilz
      Member

      how to use

      my code is :

      
      <?php 
            $theme_options = get_option('my_theme_settings'); 
            $count = $theme_options['count_nabz'];					 
      ?>
      
      <?php query_posts('cat=2&posts_per_page=echo "$count" ; '); ?>
      <?php while (have_posts()) : the_post(); ?>
      .
      .
      .
      

      but this code not working …

      how to display theme setting in wp query_posts ( posts_per_page ) code.

    • #1893
      Steve
      Keymaster

      @civilz– $count shouldn’t be in quotes, and you don’t have to echo it. You might want to try the format below for query_posts. It is more clear and readable.

      One other thing, $count = $theme_options['count_nabz'] is probably an array. You can see this by typing print_r($count);

      So the full code should be:

      $theme_options = get_option('my_theme_settings'); 
      $count = $theme_options['count_nabz'];
      $count = $count[0];
      
      $args = array(
        'cat' => 2,
        'posts_per_page'=> $count
      );
      
      query_posts( $args );
    • #1896
      civilz
      Member

      Thanks a lot …

Viewing 2 reply threads
  • The topic ‘display theme setting in wp query_posts’ is closed to new replies.