Category: Wordpress

Echo User Role WordPress PHP

$user = new WP_User( $user->ID ); if ( !empty( $user->roles ) && is_array( $user->roles ) ) { foreach ( $user->roles as $role ) echo ucfirst($role); }

Read more

How to Add Custom Fields to User Profile – WordPress

Super easy way to add custom fields to the user profile on WordPress. This will take you 3 seconds to implement.   function modify_contact_methods($profile_fields) { // Add new fields – this can be as many as you like $profile_fields[‘cool_new_field’] = ‘Twitter Username’; // Remove old fields unset($profile_fields[‘some_existing_field_you_hate’]); return $profile_fields; } add_filter(‘user_contactmethods’, ‘modify_contact_methods’); //And if you […]

Read more

Use WordPress Media Uploader in your Custom Plugin

This will make is Basicly what I did was adding this to my plugin: function test_admin_scripts() { wp_enqueue_script(‘media-upload’); wp_enqueue_script(‘thickbox’); wp_enqueue_script(‘jquery’); } function test_admin_styles() { wp_enqueue_style(‘thickbox’); } add_action(‘admin_print_scripts’, ‘test_admin_scripts’); add_action(‘admin_print_styles’, ‘test_admin_styles’); And later this part: <script language=”JavaScript”> jQuery(document).ready(function() { jQuery(‘#upload_image_button’).click(function() { formfield = jQuery(‘#upload_image’).attr(‘name’); tb_show(”, ‘media-upload.php?type=image&TB_iframe=true’); return false; }); window.send_to_editor = function(html) { imgurl = jQuery(‘img’,html).attr(‘src’); […]

Read more

Error when updating plugins by FTP “Unable to locate WordPress Content directory (wp-content).” SOLVED

Error when updating plugins by FTP “Unable to locate WordPress Content directory (wp-content).” SOLVED if(is_admin()) { add_filter(‘filesystem_method’, create_function(‘$a’, ‘return “direct”;’ )); define( ‘FS_CHMOD_DIR’, 0751 ); } Hope this helps.

Read more

List Posts Only from Specific Category – WordPress

Read more

WordPress Shortcode to Display the Loop

Just paste this into your theme’s function file.

Read more