'hangar_wpplugin_field_olderthandate', // 'class' => 'hangar-wpplugin-row', // 'hangar_wpplugin_custom_data' => 'custom', // ] // ); } } /** * register our hangar_wpplugin_settings_init to the admin_init action hook */ add_action( 'admin_init', 'hangar_wpplugin_settings_init' ); /** * custom option and settings: * callback functions */ // home control panel cb // to see wich pages and post are shown in home page if( ! function_exists('hangar_wpplugin_section_control_home_cb') ){ function hangar_wpplugin_section_control_home_cb(){ global $wpdb; $querystr = " SELECT wposts.post_name,wposts.ID, users.user_login, m1.meta_value as inicio, m2.meta_value as orden FROM $wpdb->posts wposts INNER JOIN $wpdb->postmeta m1 ON wposts.ID = m1.post_id INNER JOIN $wpdb->postmeta m2 ON wposts.ID = m2.post_id INNER JOIN $wpdb->users users ON wposts.post_author = users.ID WHERE (wposts.post_type = 'post' OR wposts.post_type = 'page') AND m1.meta_key = 'Inici' AND m1.meta_value = '1' AND m2.meta_key = 'Ordre_inici' GROUP BY ID ORDER BY inicio DESC, CAST(orden AS SIGNED) ASC "; echo'
'; // title controlled in settings_section // echo '

Control Home


'; $pageposts = $wpdb->get_results($querystr, OBJECT); if ($pageposts): global $post; echo ""; foreach ($pageposts as $post): $nom = $post->post_name; $id = $post->ID; $autor = $post->user_login; $inici = $post->inicio; $ordre = $post->orden; echo ""; endforeach; echo "
Nombre Post Id Autor Post Inicio Orden
$nom $id $autor $inici $ordre
"; endif; } } // olderthandate section cb // section callbacks can accept an $args parameter, which is an array. // $args have the following keys defined: title, id, callback. // the values are defined at the add_settings_section() function. if( ! function_exists('hangar_wpplugin_section_olderthandate_cb') ){ function hangar_wpplugin_section_olderthandate_cb( $args ) { ?>

. // the "class" key value is used for the "class" attribute of the containing the field. // you can add custom key value pairs to be used inside your callbacks. if( ! function_exists('hangar_wpplugin_field_olderthandate_cb') ){ function hangar_wpplugin_field_olderthandate_cb( $args ) { // get the value of the setting we've registered with register_setting() $options = get_option( 'hangar_wpplugin_options' ); // output the field ?>

number of days from today to the past or the date from wich will be considered old posts. Then the class oldpost will be added to the post and pages so you can apply a css style to your theme.', 'hangar-wpplugin-textdomain' ); ?>