If you want to change user color scheme for all users on your site and change user experience. You can change default admin color scheme without any plugin. You need need to add small code snippet into your theme’s functions.php file. You can find this file in your theme folder.
Open functions.php file and put following code in that file.
There are many wordpress admin related methods and code snippet written in my site. simply use search functionality for more code snippets or check wordpress tutorials section.
Many latest framework are loading all javascript in footer. They reduce the page loading the errors. But wordpress load the jquery and other javascript in header.
loading javascript libraries in footer will be always best for every web or mobile application. Here in this article, I will show to Load jQuery in wordpress footer section.
But using following code you can load your javascripts and jquery in footer area. You just need to copy and paste the following code into the functions.php file.
Load jQuery in wordpress footer section
function wpai_add_jquery_in_footer( &$scripts) {
if ( ! is_admin() )
$scripts->add_data( 'jquery', 'group', 1 );
}
add_action( 'wp_default_scripts', 'wpai_add_jquery_in_footer' );
After doing the this you js scripts will load in footer. This js will load in footer for only normal users, Not for admin user.
Many times people create bigger post or article. Many wp developers asks me many questions daily. Most commonly I asked about showing the all the post images as slide show or only thumbs. Using following code you can fetch the wordpress thumbnails. You just need to put following code into your functions.php file.
How to display attached images of posts
Using following code you can display attached images of posts. You just need to put following code into your functions.php file and you will be done.
functions.php file you can find in your wordpress theme folder. Put following function in that file.
Creating the pages by using script or in wordpress is very easy. You just need to the following code snippet for create pages programmatically in wordpress. Many times we need to create the default page or post in wordpress. You just need to the following code snippet in functions.php file or your can put following code in your plugin file.
create pages programmatically in wordpress
If you are the wordpress plugin or theme developer then following code sample is rally useful to create the empty post or page in wordpress.
Code for File upload with meta box in wordpress using custom post type using meta boxes in wordpress. From wordpress 3.0 version wordpress introduced the custom_post_type function. Many people want to attach the file field with add_meta_box function. In this tutorial I will tell you how to upload file with custom meta box and post type. I tested above code with new wordpress versions 3.9. Still code is working fine.
Code for File upload with meta box in wordpress using custom post type using meta boxes in wordpress.
In this tutorial I will show you how to create the custom post type and add custom meta boxes to that post type and upload file with custom meta box.
After digging into wordpress files and functions I created following code. Just open your functions.php file and put following code in that file for creating custom post type.
For uploading the file through custom meta box use the following code. Following code will add the file field to custom meta box and you are able to upload file or image to wordpress and upload file attachment to you custom post. Following code is very helpful to many wordpress theme and plugin developer. If you are having any issues or trouble using code then get back to me.
For Uploading the file your post form need to add the enctype=”multipart/form-data” type to your form. Just use the following code in your functions.php file.
[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]
From wordpress 3.0 version release wordpress gives the facility to add a custom post type functionality. With custom post type wordpress is became more powerful and expendable and more advanced We given info about, How to use custom post type in wordpress.
How to use custom post type in wordpress
WordPress recognized the need to people and industry and they introduced the custom post type. In this tutorial I will tell you how to use the custom post type very effectively.
Adding Custom post type is very easy. Using theme or plugin file you can add the custom post types in wordpress admin area.
Here I am going to give you example using wordpress theme files. Open you functions.php file and copy paste the following code in that file.
The function register_post_type() accepts two arguments: the name we want to give our post type, and a list of arguments used to create that post type, which we put in an array called $args.
Using above code that code will add the product post type to wordpress panel.
Now you can add the meta fields to custom post type. Use the following code in file for add the meta fields. Custom meta fields function is available from quite some time. add_meta_box() function is very useful to adding custom fields to wordpress post.
Using following code you can see the product information in edit product page and you can able to see the all information in for edit. Admin will know which fields are available to edit.
Using custom post type and add meta tag you can develop very nice applications. Now I am going to show you how you can extract the custom posts in wordpress frontend.
Using wp_query you can easily extract product posts. In any category page or conditionally you can use following code.
Or you can create the custom theme page using following code. Just create product.php page in your wordpress theme folder.Put following code in that file.