keithg

add Text box in setting page – wordpress

Add code in function.php add_filter(‘admin_init’, ‘fbfn’); function fbfn() { register_setting(‘general’, ‘fb_id’, ‘esc_attr’); add_settings_field(‘fb_id’,”.__(‘Become a fan ‘ , ‘fb_id’ ).” , ‘fb_html’, ‘general’); } function fb_html() { $fb = get_option( ‘fb_id’, ” ); echo “<input type=’text’ id=’fb_id’ name=’fb_id’ value='”.$fb.”‘ >”; }  Read more …
keithg

inline javascript and css using hook – wordpress

add_action( ‘wp_head’, ‘print_my_custom_scripts’ ); function print_my_custom_scripts() { print ‘<script type=”text/javascript”>jQuery(document).ready(function() { alert(‘WordPress’)   });</script>’; print ‘<style type=”text/css”>.align{margin-left:32px;}</style>’; }Read more …
keithg

hide pages from page list

add_filter( ‘parse_query’, ‘exclude_pages_from_admin’ ); function exclude_pages_from_admin($query) { global $pagenow,$post_type; if (is_admin() && $pagenow==’edit.php’ && $post_type ==’page’) { $query->query_vars[‘post__not_in’] = array(‘156′,’157′,’167′,’159′,’74’,’158′,’160′,’161′,’169′,’71’); } }Read more …

Parse json data error in javascript

Whenever parse the encoded json data through jquery function $.parseJSON(data) ,It checks for json object format so parse json data error occur for the json array formated data pass in the function. To solve this issue data encode with the json_encode($data,JSON_FORCE_OBJECT).Read more …
dhavalp

WordPress wp-admin login issue

when we try to access wp-admin and get error “Warning: Cannot modify header information – headers already sent by (output started at /websites/LinuxPackage05/7y/tz/nj/mysite-hosting.co.uk/public_html/wp-includes/pluggable.php:1) in /websites/LinuxPackage05/7y/tz/nj/7ytznj-256344.mysite-hosting.co.uk/public_html/wp-includes/pluggable.php on line 898” and can not access wp-admin then it will be plugin conflict issue. So normally you would have to deactivate all plugin and...Read more …