Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter jojobear99

    (@jojobear99)

    After giving this further digging, I rewrote the function pages_to_option_elements to show all pages (or you could change the parameters of get_pages() if you only wanted to show the children of a specific page, etc). According to the documentation, query_posts is not recommended to be used by plugins or themes, so I’ve changed it to use get_pages instead. You are welcome to include this code in future versions of the plugin if it improves the plugin.

    function pages_to_option_elements ( $current_page_id )
    		{
    			$pages = get_pages();
    			foreach ( $pages as $page ) {
    				$option = '<option value="' . $page->ID . '" ' . selected( $current_page_id , $page->ID ) . '>';
    				if (  $page->post_title != '') {
    					$option .= $page->post_title;
    				} else {
    					$option .= _e( '(no title)' , 'simple-page-to-sidebar' );
    				}
    				$option .= '</option>';
    				echo $option;
    			}
    		}
Viewing 1 replies (of 1 total)