WordPress.org

Ready to get started?Download WordPress

Forums

Call a category without theme settings (2 posts)

  1. voiceofbsl
    Member
    Posted 2 years ago #

    My theme has the following code to call the category name from theme setting. I remove the setting as I wanted to disable that option to change the category ID. But I don't know hoe to call a specific category with this code?

    My theme has this code to call category from theme settings page.

    <?php $recent = new WP_Query("cat=".get_theme_mod('featuredcat')."&showposts=1"); while($recent->have_posts()) : $recent->the_post();?>

    What should i change to set a specific category without calling it from theme settings page? Can anyone help me?

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters

    example (for a category with the ID 27):

    <?php $recent = new WP_Query("cat=27&showposts=1"); while($recent->have_posts()) : $recent->the_post();?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.