WordPress.org

Support

Support » Plugins and Hacks » Checkboxes with pages in a plugin (almost working, need help with names)

Checkboxes with pages in a plugin (almost working, need help with names)

  • Hello all, I am building a small plugin where I need to be able to select existing pages.

    I am trying to get checkboxes with each page existing. I altered someone’s code for categories and I managed to get it almost working. The checkboxes seem to work and I get more of them when I add pages. Only thing that doesn’t work is the displaying of the page name next to the checkbox. All I managed to get was nothing or ‘array’

    $pages = get_pages();
    foreach ($pages as $page)
        {
            echo "<input type='checkbox' name='mychecky' value='$page->term_id' />";
            echo $page->$page_id;
            echo '<br>';
        }

    Ofcourse this code should be childischly simple, I just cannot seem to get this line right: echo $page->$page_id;

    Any help with the right line here would be greatly appreciated!

  • The topic ‘Checkboxes with pages in a plugin (almost working, need help with names)’ is closed to new replies.