Part of a function i'm using in my single.php page is

$myposts = get_posts(array('numberposts' => 10, 'offset' => 0,'post_status'=>'publish','category' => 32));

I need to make the number 32 dynamic so it can be set from the dashboard

I'm familiar with advanced custom fields for posts. Is there a similar plugin that would let me create custom options? Or can someone suggest a good modern tutorial on creating a basic option like this in the dashboard



I found this plugin that let me create custom options and set the value dynamically in my templates. Worked out fine


  • IMHO not really useful to set categories ID, once you migrate all the IDs wil change, it will be sorted out.You can try pass the category name and use get_term_by(). – Diana Jul 28 '12 at 22:35
  • Well that's my reason for making it dynamic so that on a new server it can be set dynamically from the dashboard. – Anagio Jul 28 '12 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.