WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Folthan
    Member
    Posted 3 months ago #

    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!

Reply

You must log in to post.

About this Topic