wordpress 3.5 is Worst Update in release History

WordPress news, wordpress 3.5 is Worst Update in release History. we have high traffic site.  we updated our 3 of sites to 3.5 and sites goes down after wordpress update.

wordpress 3.5 is Worst Update in release History

I faced lots of issues due to this update. To figure out the issue I spent the hours.
After that I finalized to downgrade the wordpress version to 3.4.2

WordPress really did something messy in this release.

I downgraded my wordpress 3.5 to 3.4.2 wordpress release. Now my sites are stable.
I took help from following articles.

http://iblog4dollars.com/2013/01/02/wordpress-problems-how-to-downgrade-from-wordpress-3-5/

Some points are not mentioned in above article. Which is as follows:
Keep your wp-config.php, .htaccess and robots.txt file
Do not forget about sitemap.xml files.

wordpress 3.5 is Worst Update in Wordpess release History
wordpress 3.5 is Worst Update in Wordpess release History

How to wordpress add javascript to page template

For many purpose and designs we use the page template in wordpress site. WordPress tutorial for, How to wordpress add javascript to page template. Some time we need to load the custom javascript to page template. Here is code for same.

How to wordpress add javascript to page template

For that we can use following code.

add_action('wp_enqueue_scripts','Load_Template_Scripts_wpapi');
function Load_Template_Scripts_wpapi(){
    if ( is_page_template('custom-page.php') ) {
        wp_enqueue_script('my-script', 'path/to/script.js');
    }
}

For loading any script or any custom code you can use above action in wordpress. Above code you need to add in functions.php file. Which you can find in your wordpress theme folder.

How to wordpress add javascript to page template
How to wordpress add javascript to page template

How to save metadata in wordpress custom post type

Custom post type are very important in wordpress. Code for save metadata in wordpress custom post type. There are some plugins for creating the post type but I recommend custom code in function.php file.

How to save metadata in wordpress custom post type

I already written about custom post type. If you want to know about custom post type in detail then you can use following articles.

Here in this tutorial I showed How to save the meta data for your custom post type.

add_action( 'add_meta_boxes', 'job_detail_box' );

function job_detail_box() {
add_meta_box(
'job_detail_box',
__( 'job Detail', 'myplugin_textdomain' ),
'job_detail_box_content',
'job',
'normal',
'high'
);
}

function job_detail_box_content( $post ) {
// No need to globalise a post that is an argument on this callback
$meta_p = get_post_meta($post->ID, "jobs_price", true);
$meta_l = get_post_meta($post->ID, "jobs_location", true);

echo '<input type="hidden" name="jobs-nonce" id="jobs-nonce" value="' . wp_create_nonce( 'jobs-nonce' ) . '" />';

?>
<div>
<ul>

<ul>

<ul>
	<li><label>job Price</label>php echo $meta_p; ?>" /></li>
</ul>

</ul>

<ul>

<ul>
	<li><label>job Location</label>php echo $meta_l; ?>" /></li>
</ul>

</ul>

</ul>
</div>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
}

add_action ('save_post', 'save_jobs');

// The save_post hook provides the post id to the return function
function save_jobs( $post_id ){

if ( !wp_verify_nonce( $_POST['jobs-nonce'], 'jobs-nonce' )) {
return $post_id;
}

if ( !current_user_can( 'edit_post', $post_id ))
return $post_id;

update_post_meta($post_id, "jobs_price", $POST['jobs_price'] );
update_post_meta($post_id, "jobs_location", $POST['jobs_location'] );
}

How to save the meta data in wordpress custom post type
How to save the meta data in wordpress custom post type

	

how to display post count of all wordpress tags

In this article, wordpress tutorial, how to display post count of all wordpress tags. In wordpress post we use post tags. For SEO purpose we can show post tags.

how to display post count of all wordpress tags

If we want to show the post count related to wordpress tags.

You can use following code:

<?php
//list all tags that are assigned to posts
$taxonomy = 'post_tag';
$terms = get_terms( $taxonomy, '' );
if ($terms) {
foreach($terms as $term) {
if ($term->count > 0) {
echo '<p>' . '<a href="' . esc_attr(get_term_link($term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a> has ' . $term->count . ' post(s). </p> ';
}
}
}
?>
how to display post count of all wordpress tags
how to display post count of all wordpress tags

10+ wordpress lightbox plugins useful for slideshow

Jquery lightbox is mostly used for slideshows in web based project. In wordpress that is most favorite. Here I collected some nice wordpress lightbox plugins.

wordpress lightbox plugins

Lightbox Plus ColorBox

Lightbox Plus ColorBox,wordpress lightbox plugins
wordpress lightbox plugins

Lightbox Plus ColorBox implements ColorBox as a lightbox image overlay tool for WordPress. ColorBox was created by Jack Moore and is licensed under the MIT License. Lightbox Plus ColorBox for WordPress implements ColorBox as a lightbox image overlay tool for WordPress. ColorBox was created by Jack Moore and is licensed under the MIT License. Lightbox Plus ColorBox permits users to view larger versions of images without having to leave the current page. Lightbox is able to add a lightbox to WordPress gallery images, display simple slide shows, video, forms and external content in overlays. The use of the dark or light background, which dims the page over which the image has been overlaid, also serves to highlight the image or video being viewed. Lightbox Plus ColorBox captures the image title for display in the overlay.

Simple Lightbox

Simple Lightbox,wordpress lightbox plugins
wordpress lightbox plugins

The next generation of Simple Lightbox is here and ready for brave beta testers. Sign up for SLB 2.0 beta now while there’s still space available!

Simple Lightbox is a very simple and highly customizable lightbox that is easy to add to your WordPress website. It also supports skins, so it can be fully integrated with your site’s theme.

WP Lightbox 2

WP Lightbox 2,wordpress lightbox plugins
WP Lightbox 2,wordpress lightbox plugins

From 2.1, the default view changed to Colorbox due to the license regulation by the plugin directory. This plugin used to add the lightbox (overlay) effect to the current page images on your WordPress blog. Used to overlay images on the current page. Extension of wp-jquery-lightbox.

Just install and sit back. This plugin enable image overlay lighbox effect for all the post images in your wordpress plugin. No configuration required.

WP jQuery Lightbox

WP jQuery Lightbox,wordpress lightbox plugins
WP jQuery Lightbox,wordpress lightbox plugins

This plugin lets you keep the awesome Lightbox 2-functionality, but sheds the bulk of the Prototype Framework and Scriptaculous Effects Library.
Warren Krewenki ported Lightbox to jQuery and this plugin is mostly a wrapper to his work: providing localization support, an admin panel for configuration, (optional) auto-boxing of your image links and support for WordPress galleries, including media library titles and captions.

Lightbox Gallery

Lightbox Gallery,wordpress lightbox plugins
Lightbox Gallery,wordpress lightbox plugins

the default view changed to Colorbox due to the license regulation by the plugin directory. If you would prefer the prior Lightbox to Colorbox, you need to get the script from the setting page.

Clifton’s Lightbox

Clifton's Lightbox,wordpress lightbox plugins
Clifton’s Lightbox,wordpress lightbox plugins

Clifton’s Lightbox implements a lightbox subscription form overlay. Features a title, list, call-to-action, and image or YouTube video. Users can embed their subscription form into the lightbox and use the call-to-action area to encourage new subscribers.
Clifton’s Lightbox Demo
http://cliftonhatfield.com/cliftons-lightbox/

Lightbox Pop

Lightbox Pop,wordpress lightbox plugins
Lightbox Pop,wordpress lightbox plugins

This plugin allows you to create a lightbox popup with custom contents. You can customize the popup display by configuring various settings such as position settings (height, width, top,left), display logic settings (time delay after page load, number of pages to browse, lightbox repeat interval) and style settings(z-index, overlay opacity, color, border etc). You can use the plugin to display any type of contents such as special promotions, subscription forms, social media icons, feedback forms, video presentations and much more.

jQuery Lightbox

Used to add the lightbox effect to images on your WordPress blog 🙂

You can check for more information and samples here.
http://www.pedrolamas.com/projectos/jquery-lightbox-en/

jQuery Lightbox For Native Galleries

Lightbox Gallery,wordpress lightbox plugins
Lightbox Gallery,wordpress lightbox plugins

Makes the native WordPress galleries use a lightbox script called ColorBox to display the fullsize images right there in the page. No modifications required.

Frndzk Photo Lightbox Gallery

Frndzk photo lightbox plugin adds lightbox effect to all photos of every post and pages. it also shows photos in a group of a post like a photo album. it has next and previous to navigate photos. Just install the plugin and see your photos! no setup or configuration needed
demo
http://bitto.us/wp/fpgdemo

show pdf in post on wordpress

There are people who are struggling for showing PDF file in there wordpress post. Please use following steps for show pdf in post wordpress.

show pdf in post wordpress

1) Go to media -> Add New, upload a file. Once file is uploaded, you will get File URL. Copy that file URL. (Let me call it MY_PDF_URL)

This will be a complete URL, with http://yourdomain.com in it..
2) Now, go to add new post and switch to html editor. Place this code where you want to show the pdf 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.”]

<embed src="MY_PDF_URL" width="600" height="400">

This will work smoothly. OR you can use following code as well.


<iframe src="http://docs.google.com/gview?url=https://purabtech.in/wp-content/uploads/yourpdf.pdf&embedded=true" style="width:880px; height:1200px;" frameborder="0">

[/viral-lock]

There are also nice wordpress plugins for showing the PDF in wordpress posts.

Embed PDF

Will embed a PDF file using Google Docs Viewer Simply include the URL for a PDF document on it’s own line, or wrapped in the embed tag like

Click to access file.pdf

and the plugin will embed the PDF into the page using the Google Docs Viewer embed code. The url must end with .pdf

Supported attributes in the embed tag are class id title height and width

GroupDocs Word, Excel, Powerpoint, Image and PDF Annotate

GroupDocs Annotation lets you embed several types of files into your WordPress pages using the GroupDocs Viewer – allowing inline viewing and annotation of the following file types, with no Flash or PDF browser plug-ins required:

  • Adobe Acrobat (PDF)
  • Microsoft Word (DOC/DOCX)
  • Microsoft Excel (XLS/XLSX)
  • Microsoft PowerPoint (PPT/PPTX)

GroupDocs Annotation lets you view and comment on documents online. Its document annotation features makes it a powerful tool for collaboration. You and your colleagues can collaborate on a document, at the same time, to improve communication and speed up document reviews. GroupDocs Annotation lets you work with text-based documents as well as images. You can collaborate on layouts, drawings and designs just as effectively as on articles, stories and corporate documents. In short GroupDocs Annotation lets you annotate on many file formats including PDF’s, Word documents, Excel documents, Powerpoint documents and many other available formats.

show pdf in post wordpress
show pdf in post wordpress

 

for showing flash intro in sites and flash with wordpress website, we have written article. You might need for your website.

most used wordpress functions in theme

In wordpress theming is very important. Developers know the importance of functions.php file. Here we given most used wordpress functions in theme which will be useful for wordpress developer. I always written some very nice code snippets in functions.php file.

most used wordpress functions in theme

I found very useful codes which is very helpful for very wordpress designer and developers.

Here is very useful code snippets.
Enable Hidden Admin Feature displaying ALL Site Settings

// CUSTOM ADMIN MENU LINK FOR ALL SETTINGS
   function all_settings_link() {
    add_options_page(__('All Settings'), __('All Settings'), 'administrator', 'options.php');
   }
   add_action('admin_menu', 'all_settings_link');

Remove Update Notification for all users except ADMIN User

// REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN
       global $user_login;
       get_currentuserinfo();
       if (!current_user_can('update_plugins')) { // checks to see if current user can update plugins
        add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
        add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
       }

Include custom post types in the search results.

// MAKE CUSTOM POST TYPES SEARCHABLE
function searchAll( $query ) {
 if ( $query->is_search ) { $query->set( 'post_type', array( 'site','plugin', 'theme','person' )); }
 return $query;
}
add_filter( 'the_search_query', 'searchAll' );

Add your custom post types to your sites main RSS feed by default.

// ADD CUSTOM POST TYPES TO THE DEFAULT RSS FEED
function custom_feed_request( $vars ) {
 if (isset($vars['feed']) && !isset($vars['post_type']))
  $vars['post_type'] = array( 'post', 'site', 'plugin', 'theme', 'person' );
 return $vars;
}
add_filter( 'request', 'custom_feed_request' );

Modify the Login Logo & Image URL Link

add_filter( 'login_headerurl', 'namespace_login_headerurl' );
/**
 * Replaces the login header logo URL
 *
 * @param $url
 */
function namespace_login_headerurl( $url ) {
    $url = home_url( '/' );
    return $url;
}

add_filter( 'login_headertitle', 'namespace_login_headertitle' );
/**
 * Replaces the login header logo title
 *
 * @param $title
 */
function namespace_login_headertitle( $title ) {
    $title = get_bloginfo( 'name' );
    return $title;
}

add_action( 'login_head', 'namespace_login_style' );
/**
 * Replaces the login header logo
 */
function namespace_login_style() {
    echo '<style>.login h1 a { background-image: url( ' . get_template_directory_uri() . '/images/logo.png ) !important; }</style>';
}

Loading jQuery from the Google CDN

// even more smart jquery inclusion :)
add_action( 'init', 'jquery_register' );

// register from google and for footer
function jquery_register() {

if ( !is_admin() ) {

    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', ( 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' ), false, null, true );
    wp_enqueue_script( 'jquery' );
}
}

Remove the WordPress Version Info for Security

// remove version info from head and feeds
function complete_version_removal() {
    return '';
}
add_filter('the_generator', 'complete_version_removal');

Add Spam & Delete Links to Comments on Front End

// spam & delete links for all versions of wordpress
function delete_comment_link($id) {
    if (current_user_can('edit_post')) {
        echo '| <a href="'.get_bloginfo('wpurl').'/wp-admin/comment.php?action=cdc&c='.$id.'">del</a> ';
        echo '| <a href="'.get_bloginfo('wpurl').'/wp-admin/comment.php?action=cdc&dt=spam&c='.$id.'">spam</a>';
    }
}

Remove Default WordPress Meta Boxes

// REMOVE META BOXES FROM DEFAULT POSTS SCREEN
   function remove_default_post_screen_metaboxes() {
 remove_meta_box( 'postcustom','post','normal' ); // Custom Fields Metabox
 remove_meta_box( 'postexcerpt','post','normal' ); // Excerpt Metabox
 remove_meta_box( 'commentstatusdiv','post','normal' ); // Comments Metabox
 remove_meta_box( 'trackbacksdiv','post','normal' ); // Talkback Metabox
 remove_meta_box( 'slugdiv','post','normal' ); // Slug Metabox
 remove_meta_box( 'authordiv','post','normal' ); // Author Metabox
 }
   add_action('admin_menu','remove_default_post_screen_metaboxes');

// REMOVE META BOXES FROM DEFAULT PAGES SCREEN
   function remove_default_page_screen_metaboxes() {
 remove_meta_box( 'postcustom','page','normal' ); // Custom Fields Metabox
 remove_meta_box( 'postexcerpt','page','normal' ); // Excerpt Metabox
 remove_meta_box( 'commentstatusdiv','page','normal' ); // Comments Metabox
 remove_meta_box( 'trackbacksdiv','page','normal' ); // Talkback Metabox
 remove_meta_box( 'slugdiv','page','normal' ); // Slug Metabox
 remove_meta_box( 'authordiv','page','normal' ); // Author Metabox
 }
   add_action('admin_menu','remove_default_page_screen_metaboxes');

Add Custom User Profile Fields

// CUSTOM USER PROFILE FIELDS
   function my_custom_userfields( $contactmethods ) {

    // ADD CONTACT CUSTOM FIELDS
    $contactmethods['contact_phone_office']     = 'Office Phone';
    $contactmethods['contact_phone_mobile']     = 'Mobile Phone';
    $contactmethods['contact_office_fax']       = 'Office Fax';

    // ADD ADDRESS CUSTOM FIELDS
    $contactmethods['address_line_1']       = 'Address Line 1';
    $contactmethods['address_line_2']       = 'Address Line 2 (optional)';
    $contactmethods['address_city']         = 'City';
    $contactmethods['address_state']        = 'State';
    $contactmethods['address_zipcode']      = 'Zipcode';
    return $contactmethods;
   }
   add_filter('user_contactmethods','my_custom_userfields',10,1);

Add an excerpt box for pages

if ( function_exists('add_post_type_support') )
{
    add_action('init', 'add_page_excerpts');
    function add_page_excerpts()
    {
        add_post_type_support( 'page', 'excerpt' );
    }
}

Function to change the length of Exerpt

function new_excerpt_length($length) {
    return 100;
}

add_filter('excerpt_length', 'new_excerpt_length');

Auto Extract the First Image from the Post Content

/ AUTOMATICALLY EXTRACT THE FIRST IMAGE FROM THE POST
function getImage($num) {
    global $more;
    $more = 1;
    $link = get_permalink();
    $content = get_the_content();
    $count = substr_count($content, '<img');
    $start = 0;
    for($i=1;$i<=$count;$i++) {
        $imgBeg = strpos($content, '<img', $start);
        $post = substr($content, $imgBeg);
        $imgEnd = strpos($post, '>');
        $postOutput = substr($post, 0, $imgEnd+1);
        $postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '',$postOutput);;
        $image[$i] = $postOutput;
        $start=$imgEnd+1;
    }
    if(stristr($image[$num],'<img')) { echo '<a href="'.$link.'">'.$image[$num]."</a>"; }
    $more = 0;
}

Unregister WP Default Widgets

// unregister all default WP Widgets
function unregister_default_wp_widgets() {
    unregister_widget('WP_Widget_Pages');
    unregister_widget('WP_Widget_Calendar');
    unregister_widget('WP_Widget_Archives');
    unregister_widget('WP_Widget_Links');
    unregister_widget('WP_Widget_Meta');
    unregister_widget('WP_Widget_Search');
    unregister_widget('WP_Widget_Text');
    unregister_widget('WP_Widget_Categories');
    unregister_widget('WP_Widget_Recent_Posts');
    unregister_widget('WP_Widget_Recent_Comments');
    unregister_widget('WP_Widget_RSS');
    unregister_widget('WP_Widget_Tag_Cloud');
}
add_action('widgets_init', 'unregister_default_wp_widgets', 1);

Enable GZIP output compression

if(extension_loaded("zlib") && (ini_get("output_handler") != "ob_gzhandler"))
   add_action('wp', create_function('', '@ob_end_clean();@ini_set("zlib.output_compression", 1);'));

Enable shortcodes in widgets

// shortcode in widgets
if ( !is_admin() ){
    add_filter('widget_text', 'do_shortcode', 11);
}

If you have any interesting code snippets then please suggest me.

most used wordpress functions in theme
most used wordpress functions in theme

wordpress XMLRPC api integration with ruby and rails

Ruby on Rails is really OOPs based framework. I personally love this framework. I worked on this for many years. Many Ruby lovers are looking to integrate the wordpress with Ruby on Rails. I strongly suggest to integrate wordpress with ROR using XMLRPC APIs. Using following code you can easily add the wordpress into Ruby on Rails Project. Use my following steps:

wordpress XMLRPC api integration with ruby and rails

Note: There are so many XMLRPC APIs provided by wordpress. I given the some simple example here.

First setup wordpress. Login to wordpress admin and enable the XMLRPC.
Go to Settings->writing and enable the XMLRPC checkbox.

wordpress XMLRPC api integration with ruby and rails
wordpress XMLRPC api integration with ruby and rails

Now you can fetch the wordpress posts, pages, tags etc.. using XMLRPC.

Following script is written in Ruby.

[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.”]

require 'xmlrpc/client'

# build a post

#Use this for reference - http://codex.wordpress.org/XML-RPC_wp , http://codex.wordpress.org/XML-RPC_WordPress_API

post = {
'post_title'       => 'Post Title',
'post_excerpt'       => 'Post excerpt',
'post_content'       => 'this is Post content'
}

# initialize the connection - Change

connection = XMLRPC::Client.new2('http://www.purabtech.in/wordpress3/xmlrpc.php')  #Replace your wordpress URL

# make the call to publish a new post

#result = connection.call('metaWeblog.getRecentPosts', 1,'admin','123456') // Get Recent 10 Post
#result = connection.call('wp.getPost', 1,'admin','123456',19) // Get Single Post
#result = connection.call('wp.getPage', 1,'admin','123456',1) // Get Single Page
#result = connection.call('wp.getPages', 1,'admin','123456',10) // Get Pages
#result = connection.call('wp.getPosts', 1,'admin','123456') // Get 10 Posts from wordpress
result = connection.call('wp.getPosts', 1,'admin','123456',1000) // Get 10000 Posts from wordpress
#result = connection.call('wp.newPost', 1,'admin','123456',post) //For New Creating the Post

puts result // Printresult
puts result.length // Printresult

[/viral-lock]

If you are facing any issue then write to me.

Best of Resources for wordpress theme development

Many new designers and developers are searching for resources for wordpress theme development. Where to start and how to start the wordpress development. Many people don’t want to use the free themes and they want to develop their own theme.

Best of Resources for wordpress theme development

They want to understand about basic rules and api about wordpress theme development. Here we collected some best of urls which has best practices and guidelines about wordpress theme development.

List of free wordpress theme frameworks for wordpress theme developer

How to create wordpress theme

How To Create WordPress Themes From Scratch Part 1

How to Create a WordPress Theme from Scratch

Theme Development

Template Tags for wordpress

Blog design and development

Designing a WordPress Theme From Scratch

Future of PSD to WordPress Conversion

All time Best WordPress Ebooks

General Guidelines when you are developing the new Theme

How to create simple wordpress theme

Basic CSS rules for development of WordPress themes

I liked one picture which about wordpress theme development. This picture is by Yoast blogger.

Best of Resources for wordpress theme-development
Best of Resources for wordpress theme-development

install and update the wordpress plugins without providing ftp access

I did so much R&D about installing and updating the wordpress plugin without using ftp access. I got very nice trick to solve this issue. When you are using the shared hosting or VPS server for wordpress site hosting. You always face issue for installing the wordpress plugin or wordpress theme. It issue happen when you do the the wordpress updation. Using following simple steps you can install the wordpress plugins and themes without giving the ftp access.

update wordpress plugins without ftp access

I always did the wordpress plugins and theme updation. So every time providing the ftp credentials are really panic. So I am always using following steps for doing wordpress up-gradation.

First you need to add the following code in your wp-config.php file.

define('FTP_USER', 'username');
define('FTP_PASS', 'mypassword');
define('FTP_HOST', '192.168.2.132');
define('FTP_SSL', false);

But this is old idea. If you dont want to add the ftp access in wp-config.php file then Just add the following line wp-config.php file.


define('FS_METHOD', 'direct');

Note: You need to give 755 permission to wp-content folder. Create the upgrade folder in wp-content folder.

If still you are facing issue then give 777 permission to all wp-content folder.

For permission use following command

cd your_wordpress_directory
sudo chown -R www-data wp-content
sudo chmod -R 755 wp-content

More information:

WordPress will try to write a temporary file to your /wp-content directory. If this succeeds, it compares the ownership of the file with it’s own uid, and if there is a match it will allow you to use the ‘direct’ method of installing plugins, themes, or updates.

Now, if for some reason you do not want to rely on the automatic check for which filesystem method to use, you can define a constant, 'FS_METHOD' in your wp-config.php file that is either 'direct' 'ssh', 'ftpext' or 'ftpsockets' and it will use method. Keep in mind that if you set this to ‘direct’ but your web user (the username under which your webs server runs) does not have proper write permissions, you will receive an error.

update wordpress plugins without ftp access
update wordpress plugins without ftp access