l2aelba
  • Member for 10 years, 7 months
  • Last seen this week
Remove dashboard, use Pages tab as default
11 votes

This is how you remove DASHBOARD on your Wordpress fully ! For who don't want to use plug-in(s), If you installed a plug-in for remove that. You will get extra menu about that plug-in also. What ...

View answer
Rewrite Rule for Multilingual Website, Like qTranslate?
Accepted answer
11 votes

I got it now , After searched many resources : function lang_support() { return array('en','fr'); // Add your support lang-code (1st place is a default) } function rewrite_lang(){ $langs = ...

View answer
How do I get the size of an attachment file?
10 votes

I would do : $attachment_filesize = filesize( get_attached_file( $attachment_id ) ); Or with readable size like 423.82 KB $attachment_filesize = size_format( filesize( get_attached_file( $...

View answer
wp_localize_script with boolean and init
Accepted answer
4 votes

I just do something like this so long : wp_add_inline_script('helloworld','var site_config ='.json_encode($site_config));

View answer
Remove "Comment" column in all post-types
Accepted answer
3 votes

I got an alternative : This will not just hiding but disabling also function disable_comments() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(...

View answer
get custom post type by tag
2 votes

Use tag_slug__in not tag (#REF) Example : $query = new WP_Query(array( 'post_status' => 'publish', 'post_type' => 'your-posttype', // or 'any' 'tag_slug__in' => 'your-tag', '...

View answer
How to replace regular jquery calls with CDN calls from Google?
2 votes

For Wordpress 4.5.0 + : wp_add_inline_script() # function jquery_enqueue_with_fallback() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery' , '//ajax.googleapis.com/ajax/libs/...

View answer
How do I remove the admin bar (styling) from frontend only?
1 votes

I would do something like this : Remove admin bar / CSS in head / body class show_admin_bar(false); or if you just want to : Remove html margin-top CSS in <head> function ...

View answer
wp_insert_post() Callback?
1 votes

Oh I found ! $post_id = wp_insert_post($arg); // return post ID

View answer
How to handle multiple instance of "send_to_editor" js function
1 votes

I just put window.send_to_editor's function in .click() function $('#upload_button_1').click(function() { tb_show('','media-upload.php?type=image&amp;TB_iframe=true');...

View answer
XML to Json code issue
1 votes

Use this function form http://www.php.net/manual/en/function.json-encode.php#80339 function json_format($json) { $tab = " "; $new_json = ""; $indent_level = 0; $in_string = false; ...

View answer
Send email to admin with post author
1 votes

Missing global ? global $post; No global variable available if you are using publish_post action hook! Ref : http://hungred.com/how-to/tutorial-post-id-publishpost-action-hook-wordpress/ Update 2 :...

View answer
How to create .pot files with POedit?
0 votes

As Otto said : For Mac users, I would do something like : After installed by svn co http://develop.svn.wordpress.org/trunk/ wpdev So... Make /languages/ dir on your theme Make a command file like ...

View answer
Expanding the allowed HTML tags in comments?
0 votes

Just more exmple : function allow_tags_content() { global $allowedposttags, $allowedtags; $allowedposttags['div']['data-hello'] = true; $allowedtags['div']['data-hello'] = true; $...

View answer
How to disable WordPress from creating thumbnails?
0 votes

function remove_default_image_sizes( $sizes) { unset($sizes['thumbnail']); unset($sizes['medium']); unset($sizes['large']); return $sizes; } add_filter('...

View answer
Change WordPress language based on user setting
-1 votes

Did you mean this option ? If yes, then... $user_locale = get_user_locale(); function change_userlang_by_userlocale($locale){ global $user_locale; return $user_locale ? $user_locale : $...

View answer