How to insert category list into post creation page, and retrieve chosen categories?

By default page post type doesn’t support category taxonomy. But you can easily fix it by register category taxonomy for page post type: add_action( ‘init’, ‘wpse8170_init’ ); function wpse8170_init() { register_taxonomy_for_object_type( ‘category’, ‘page’ ); } Now you will see categories meta box in the same place as you see it at post creation page. To … Read more

File Upload from Frontend

Before Header: <?php $post_id = $post->ID; if ( isset( $_POST[‘html-upload’] ) && ! empty( $_FILES ) ) { require_once( ABSPATH . ‘wp-admin/includes/admin.php’ ); $id = media_handle_upload( ‘async-upload’, $post_id ); //post id of Client Files page unset( $_FILES ); if( is_wp_error( $id ) ) { $errors[‘upload_error’] = $id; $id = false; } if( $errors ) { … Read more

Grabbing how Many Posts by Month for a Dashboard Widget

Just Went over your code and it looks fine but you are missing the code blocks for your foreach loops so: add_action(‘wp_dashboard_setup’, ‘dashboard_test’); function dashboard_test() { global $wp_meta_boxes; wp_add_dashboard_widget(‘month_dashboard’, ‘Reports Submitted for the Year’, ‘custom_test’); } function custom_test(){ global $wpdb; $years = $wpdb->get_col(“SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status=”publish” AND post_type=”report” ORDER BY post_date DESC”); … Read more

Use wp_logout_url() in menu creation page

Add submenu with a custom link, /wp-login?action=logout, like the image below: Add code like below in functions.php: function wpa_remove_menu_item( $items, $menu, $args ) { if ( is_admin() || ! is_user_logged_in() ) return $items; foreach ( $items as $key => $item ) { if ( ‘Login / Register’ == $item->title ) unset( $items[$key] ); if ( … Read more

‘Headers already sent’ Error When Redirecting from add_submenu_page() Callback

Background The infamous “Headers already sent” error rears it’s ugly head in circumstances where something attempts to modify the HTTP headers for the server’s response after they have already been dispatched to the browser – that is to say, when the server should only be generating the body of the response. This often happens in … Read more

Is it possible to create child themes using the WordPress Dashboard?

You will achieve this in two steps: uploading minimal files at yourdomain.com/wp-admin/themes.php editing child theme at yourdomain.com/wp-admin/theme-editor.php The theme that you upload to your site via the admin console must contain three files. They will end up in your server’s filesystem like this: /wp-content/themes/parentname-child/functions.php /wp-content/themes/parentname-child/screenshot.png /wp-content/themes/parentname-child/style.css When uploading, functions.php can be empty, but style.css must … Read more

How to position custom dashboard widgets on side column

You’re right – it doesn’t. Neither does the wp_add_dashboard_widget function. So just use the generic add_meta_box and indicate dashboard and placement: add_action( ‘wp_dashboard_setup’, ‘my_dashboard_setup_function’ ); function my_dashboard_setup_function() { add_meta_box( ‘my_dashboard_widget’, ‘My Widget Name’, ‘my_dashboard_widget_function’, ‘dashboard’, ‘side’, ‘high’ ); } function my_dashboard_widget_function() { // widget content goes here }

“Discussion” checkboxes unchecked by default on pages? [duplicate]

You can re-register the “page” post type and leave out the comments capability. add_action( ‘init’, ‘my_new_page_type’ ); function my_new_page_type() { register_post_type( ‘page’, array( ‘labels’ => array( ‘name_admin_bar’ => _x( ‘Page’, ‘add new on admin bar’ ), ), ‘public’ => true, ‘publicly_queryable’ => false, ‘_builtin’ => true, /* internal use only. don’t use this when registering … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)