Support » Plugins and Hacks » [Resolved] Question Revealing ID of Pages?

[Resolved] Question Revealing ID of Pages?

Viewing 1 replies (of 1 total)
  • It’s Christmas 🙂

    Here’s the code you need :

     * Advanced Page Manager addon that adds an "ID" column to pages tree and lists.
     * @author Uncategorized Creations
    class ApmRevealIdsColumn{
    	public static function hooks(){
    		add_filter('apm_manage_pages_columns', array(__CLASS__, 'apm_manage_pages_columns'),15);
    		add_filter('apm_manage_pages_custom_column', array(__CLASS__, 'apm_manage_pages_custom_column'),10,3);
    		add_filter('apm_custom_sql_orderby', array(__CLASS__, 'apm_custom_sql_orderby'),10,3);
    	public static function apm_manage_pages_columns($columns){
    		$label = apply_filters('apm_addon_reveal_ids_column_label',__('ID', ApmConfig::i18n_domain));	
    		//Add "ID" column before native APM "template" column :
    		$additionnal_column = array('apm-reveal-ids' => '<a href="#" class="custom-sortable">
    														    <span>'. __($label) .'</span>
    														    <span class="sorting-indicator"></span>
    		$index = array_search('add_page', array_keys($columns));
    		$columns = array_slice($columns, 0, $index, true) + $additionnal_column + array_slice($columns, $index, count($columns) - $index, true) ;
    		return $columns;
    	public static function apm_manage_pages_custom_column($column_name,$post_id,$node){
    		if( $column_name == 'apm-reveal-ids' ){
    			if( $node->status > -2 ){ //Display for all "displayable" pages status
    				$page_id_html = '<p class="apm-reveal-ids">'. $post_id .'</p>';
    				$page_id_html = apply_filters('apm_addon_reveal_ids',$page_id_html,$post_id,$node);
    				echo $page_id_html;
    	public static function apm_custom_sql_orderby($order_by_sql,$order_by,$order){
    		if( $order_by == 'apm-reveal-ids' ){
    			$order_by_sql = "p.ID $order";
    		return $order_by_sql;

    The best way do use it is to create a PHP file called reveal_ids_column.php and drop it into the lib/addons plugin subfolder.

    Then access the Settings panel and activate the new addon.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Question Revealing ID of Pages?’ is closed to new replies.