0

I am building a theme options page and everything is great.

There is a function to display the list of page options.

$all_pages = get_pages();
$page_options = array();
$page_list = array();
$page_list_footer = array();
$checked_options = array();

foreach ($all_pages as $page){
    $page_list[] = "acera_nav_header_".$page->ID;
    $page_list_footer[] = "acera_nav_footer_".$page->ID;
    $page_title = get_page($page->ID);
    $page_options[] = $page_title->post_title;
    $checked_options[] = "not";
}

This is the option:

array( 
"under_section" => "Pages",
"name" => "Pages",
"desc" => "",
"id" => "anything",
"type" => "select",
"options" => $page_options,
"tip" => ""),

This is the front end code to display the selected page.

<?php echo stripslashes(get_option('anything'))  ?>

Everything is working just fine, but the problem is that I want to display the name of the page in the admin back end, and to display the ID of the selected page in front end.

This way , it displays the name of the page in front end. How can I display the ID instead.

Please if there is any solution or tweaks I can do for this, help me, I would be so thankful. Thanks

  • Where is the code that actually displays on the front end? You've built set some variables and built some arrays but I don't see anything that echos content. – s_ha_dum Jul 6 '13 at 13:17
  • Thanks for your comment, I have added the options and the function to call it in front end. Everything is working fine, The page name is displayed in the front end, but I want to display the ID.. so the fix must be done in the function itself. – Selma Jul 6 '13 at 13:47
  • Post all of your theme options code please. – s_ha_dum Jul 6 '13 at 13:59
  • I use acera theme options, It's too much of code. – Selma Jul 6 '13 at 14:08
  • What is var_dump(get_option('page_id'));? I am puzzled why something called page_id prints the page name. – s_ha_dum Jul 6 '13 at 14:09

Your Answer

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

Browse other questions tagged or ask your own question.