Showing posts with label WordPress Plugins. Show all posts
Showing posts with label WordPress Plugins. Show all posts

Thursday, May 9, 2013

Where to find WordPress Plugins

Plugins are tools to extend the functionality of WordPress. This article contains a list of plugins by category, and links to other plugin repositories. The core of WordPress is designed to be lean, to maximize flexibility and minimize code bloat. Plugins offer custom functions and features so that each user can tailor their site to their specific needs.

For instructions and information on downloading, installing, upgrading, troubleshooting, and managing your WordPress Plugins, see Managing Plugins. If you want to develop your own plugin, there is a comprehensive list of resources in Plugin Resources.
Plugin Repositories

WordPress Plugins are available from several sources. The "official" sources for WordPress Plugins are:

    Official WordPress Plugins Repository
    WordPress Plugin Database at wp-plugins.net

Not all WordPress Plugins make it into the above repositories. Try searching the web for "WordPress Plugin" and the keywords for the type of functionality you are seeking.
Default Plugins

The following plugins are included with the WordPress core distribution:

Akismet
    Akismet checks your comments against the Akismet web service to see if they look like spam or not. You can review the spam it catches under "Manage" and it automatically deletes old spam after 15 days.
Hello Dolly
    This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong. Hello, Dolly. This is, by the way, the world's first official WordPress Plugin. When enabled you will randomly see a lyric from "Hello, Dolly" in the upper right of your Administration Panels on every page but the Plugins panel.

WordPress Plugins List

The WordPress Plugins once listed herein have been removed and are no longer updated. Please see the Official WordPress Plugin Directory and WordPress Plugin Database for current listings of WordPress Plugins.

Saturday, March 23, 2013

How to Make a Featured Post Carousel for WordPress

Conceiving the default likeness
Before we do any thing, proceed to the topics folder of your WordPress installation (wp-content/topics/) and make a backup of the "default" folder. This is the Kubrik theme we will be revising. The backup is in case you desire to revert back to the initial, unmodified topic.

First, we’re going to make a default likeness in the happening no boasted mail image is specified. Let’s hold it sugary and easy for this tutorial. Open up your preferred image editor and conceive a 233x130px rectangle with 10px radius circular corners. I made the backdrop a white to grey radial gradient and put some text on peak. This is what I have:

Add the PHP code
Now for the cipher. Open the “header.php” document interior the “default” folder. At the end of the document, you will glimpse a div impede and an hr tag like this:

<div id="header">
    <div id="headerimg">
        <h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
        <div class="description"><?php bloginfo('description'); ?></div>
    </div>
</div>
<hr />

Between the ending div tag and the hr, insert the following code:
<div id="featured">
    <ul id="carousel">
        <?php
        $featured_posts = get_posts('numberposts=3&category=1');
       
        foreach( $featured_posts as $post ) {
            $custom_image = get_post_custom_values('featured_image', $post->ID);
            $image = $custom_image[0] ? $custom_image[0] : get_bloginfo("template_directory")."/images/no-featured-image.jpg";
            printf('<li><a href="%s" title="%s"><img src="%s" alt="%s" /></a></li>', get_permalink($post->ID), $post->post_title, $image, $post->post_title);
        }
        ?>
    </ul>
    <div class="clear"></div>
</div>

Style with CSS
Next we need to add some CSS styles. Open up the “style.css” document and put the following code below at the end of the document. All this does is float the register elements to the left and space them out equally.

/* Featured Post Carousel */

#featured {
    padding: 10px 10px 0 20px;
    }

#carousel {
    list-style: none;
    margin: 0;
    padding: 0;
    }

#carousel li {
    float: left;
    padding: 0;
    margin-right: 10px;



Comprehending the code
Let’s take a look at what the cipher we added does. Inside the canister div (id=”featured”) we have an unordered list and some PHP cipher to develop register elements.

$featured_posts = get_posts('numberposts=3&category=<strong>1</strong>'); 

The first line shown above retrieves the mail data using the get_mails() function and assigns the mail data to the $featured_posts variable. The get_posts() function excepts a single parameter in the form of a query string similar to what you might glimpse at the end of a URL (sans the primary inquiry mark). The first parameter is “numberposts” which we’ve set to 3 for this tutorial. This parameter sets how numerous boasted posts we will be showing. The second parameter is “category” which we’ve set to 1. The worth of the “category” parameter should be the ID of the category you are utilising for your boasted posts. You can find the ID of a class by going to the class administration sheet and hovering your mouse over a class title. The rank bar will display a link. The last number is the class ID. 

The next line is a foreach loop that will loop through the mails we’ve retrieved utilising the get_mails() function. The first line interior the foreach loop retrieves the URL of the image utilising the get_post_custom_values() function and shops the URL in the $custom_image variable. The first parameter identifies the key of the made-to-order value we’re utilising, “featured_image”. The second parameter identifies what post we’re getting the worth from. 
  
$custom_image = get_post_custom_values('featured_image'$post->ID);  


In the next line we do a quick check to see if an image was indeed specified. If no image was specified, we assign the $image variable the URL of the default image. If an image was specified, we use that.

$image = $custom_image[0] ? $custom_image[0] : get_bloginfo("template_directory")."/images/no-featured-image.jpg"; 

In the last line we actually output the list elements. Each element is an image that links to the featured post.
    printf('<li><a href="%s" title="%s"><img src="%s" alt="%s" /></a></li>', get_permalink($post->ID), $post->post_title, $image, $post->post_title); 

Creating Featured Posts
That’s it! Now, whenever you want to feature a post, assign it to the featured category and create a custom value with a key of “featured_image” and a value of the image URL. Images should be 233x130px.
 


   

Sunday, March 10, 2013

WordPress Plugins & The Security Risk

WordPress a common and famous platform for blogging and wordpress plugins are very common and make the life of blogger easy

because a plug in can perform the work fast and accurately and it does not require so much technical knowledge and skills.

WordPress plugins are available for different purposes like to tweak your blog , for SEO purpose, social sharing purpose

and for security purpose. There are so many plugins are available to provide the security of wordpress blog and they

usually called the plugins to secure a wordpress but these plugins itself has several vulnerabilities and these plugins

also plays an important role to compromise a wordpress blog.



The point is very simple that the plugins may be very dangerous for the security of wordpress blog, so what are the

security risks? And how an attacker can take the advantages of insecure wordpress plugins ?



The biggest example is timthumb vulnerability, timthumb is a script and a plugin used for crop the images but meanwhile

timthumb can be used to hack into a website, there are so many other techniques that an attacker may use to hack into a

wordpress blog, for example a malicious person has created a plugins that contain the code of the malwares and can easily

hijack the session of the visitors, now the attacker might use some social engineering and the promotion techniques to

promote the plugins and suppose that the thousands innocent bloggers has installed the plugins on their blog it means that

their visitors can be redirect to the malicious website and can be the victim of the iFrame injection security attack.



The other point of consideration:



    Whenever you install a plugin, the extra php code will insert into the core wordpress files.
    Extra plugins are the burden on the administration and it consume space.
    Old plugin may cause the compatibility problem with your current (latest) wordpress software, so the plugin will break

and disclose the sensitive information of the server.
    Third party plugins may use some data from the third party website, let suppose the other website has been compromised

and the worm spread itself then your website will be the next victim.



Although the importance of automatic scanners and plugins exist but manual review and manual security checklist has its own

importance and we should not neglect it, beside automatic scanning do review the security of your wordpress blog by

manually and do not forget to review of the source code of plugins.



The main tips to remain secure from the plugins risk is to active on the plugins community, learn about the latest changes,

update the plugin whenever available.

Friday, March 8, 2013

How to conceive a photo Album in WordPress without a plugin

In the past, we have shown you how to add a gallery in WordPress with a light box effect. That item only wrappings the exterior of the WordPress functionality. Recently, we had a client that liked us to create a photo gallery coordinated by monthly albums. They wanted the user to be adept to bang on the album photo to glimpse all posts recorded in that month’s album. Each photo should have its own individual sheet with data about the person taking photos and their URL. commonly persons would resort to plugins like NextGen Gallery or another to accomplish certain thing like this. We liked to bypass using a third party plugin therefore we determined to use the core-functionality that WordPress boasts to create certain thing that works. In this item, we will show you how to create a monthly photo album gallery in WordPress without a plugin.

What we are trying to make:
Before we start, lets take a gaze at what the final conclusion is suppose to gaze like:
When the client bang on the Albums sheet, they will glimpse an archive in a grid brandish where each album begins out with it’s distinguishing cover and all the photos in it. The concept was to have one album per month. 

If the user bangs on the album’s cover photo, they will be taken to a sheet just for that album where you can give the client some backdrop information as well as records all the photographs in that album.

If the client bangs on the photo, then they will be taken to the single photo sheet where they will see the title of the photograph. Photographer’s title and their site’s URL.

How we are going to make it?
As you can see from the description above, all of the characteristics needed can be finished using the built-in WordPress functionality. We can heal each monthly album as a post, so each album can have its own lone page with some backdrop info etc. Each likeness will be treated as an addition (thus getting its own lone page). We will use the built-in featured thumbnails for album cover photograph. You can use the default posts, if the whole site’s reason is this photo album gallery, but if you have a blog as well, then this desires to be conceived in a custom post kind.

Let’s conceive a Photo Album Gallery

First thing you should do is conceive a site-specific plugin (or even a project-specific plugin).

If you are going to use made-to-order Post kinds for your task, then you should generate the ciphers and paste it in your site-specific plugin. You can furthermore watch our video on how to conceive Custom mail Types.

Next thing you need to do is list added image dimensions in WordPress for the grid display.
Example would be:

1
add_image_size( 'album-grid', 225, 150, true );

After the added likeness dimensions, let’s add some added fields to the newspapers uploader. This will permit you to add Photographer’s title and their URL when you upload each image. This is the cause why we wrote an item about it two days ago.

How to add additional areas to the WordPress newspapers Uploader
one time you have finished this, permits go ahead and add some albums (posts). Upload all images that you desire to attach to that album. Then attach a distinctive cover photo and set it as a boasted image. You can add the backdrop info in the content area of the mail.

Now that you have a couple of albums in the backend, permits put the cipher to brandish it.
Let’s say that your custom mail kind was called albums. So you will conceive a template file called archive-albums.php. Paste the header codes, the footer ciphers, sidebar and other conceive elements that you want. conceive a mail loop. interior that mail loop, we are going to brandish all additions from a mail except the thumbnail which will connection to the single likeness page. We will also add the boasted mail thumbnail (album cover photo) individually and connection that to the single mail page (album page).

We decided to style the grid images using the list element. The code looks like this:

<li class="album-grid"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail('album-grid'); ?></a></li>
 
<?php if ( $post->post_type == 'albums' && $post->post_status == 'publish' ) {
               $attachments = get_posts( array(
                       'post_type' => 'attachment',
                       'posts_per_page' => -1,
                       'post_parent' => $post->ID,
                       'exclude'     => get_post_thumbnail_id()
               ) );
 
               if ( $attachments ) {
                       foreach ( $attachments as $attachment ) {
                               $class = "post-attachment mime-" . sanitize_title( $attachment->post_mime_type );
                               $title = wp_get_attachment_link( $attachment->ID, 'album-grid', true );
                               echo '<li class="' . $class . ' album-grid">' . $title . '</li>';
                       }
                       
               }
        }
?>


The main CSS style that you really have to worry about is the class .album-grid

.album-grid{width: 225px; height: 150px; float: left; list-style: none; list-style-type: none; margin: 0 18px 30px 0px;}

This would permit each likeness to be placed appropriately in the grid, and we will get the method how we desire it.

Next thing you need to do is conceive a single-attachment template. This will be the sheet where the user will be taken to, so they can view each individual likeness. They will glimpse the likeness name, photographer’s title and photographers URL here. You can follow our tutorial on How to Create a Custom Single additions Template in WordPress.

seem free to method the lone template although you like.
Now the only thing left in the register is to conceive an individual albums sheet. afresh presuming that your custom mail kind is called albums, you will need to conceive a single-albums.php file. Copy all the header, footer, sidebar, or any other design components that you want.

In the loop element fundamentally do the same thing that we did with the archive-albums template. Before you add the boasted likeness and the additions grid though, you need to add the album title and description. Which can be finished by easily adding the cipher like this?

<h1><?php the_title(); ?></h1>
<div class="entry-content"><?php the_content(); ?></div>
 
//Insert grid code below this line

Ta ad, we are done. We just created a monthly photo album gallery in WordPress without using any plugin. Let us know if you have any questions.

Create WordPress Plugins with OOP Techniques



Object-oriented code, among other equipment, can help systematize and add reusability to your code. In this lesson, I will instruct you the basics of inscription a WordPress plugin using object oriented techniques. We’ll be using Dribbble’s API as an instance for this lesson. Prepared?

What We’re Going to Learn:

  • Advantages of using OOP for WordPress plugins.
  • How to install a shortcode.
  • How to install a template tag.
  • How to allow shortcode in WordPress widgets.
  • Real-world instance by using Dribbble’s API.

Why Use OOP?

Before touching onward with this lesson, you should have at least an simple accepting of writing a WordPress plugin. Give it a study.
Building WordPress plugins with object oriented code is fairly well-organized and orderly, when compared to using procedural code. It’s easier to control the code base, and make bigger it using inheritance techniques, which can be chiefly helpful when writing a bulky plugins.

Dribbble

To inscribe a WordPress plugin, we first require a sense of way. We’re going to inscribe a plugin that will show the newest shots from(Take care This)  Dribbble, using their REST API. We’ll then add short code maintain for posts and widgets, and template tag for themes.

Step 1 - Setting up the Plugin Class

Object oriented code is supported on classes and methods (functions). Let’s build our core class, which will cooperate with WordPress’ hooks and filters.
PHP classes contain a constructor function, __construct, which is effected as soon as a new example of a class is instantiated. All WordPress hooks and filters will be registered under the constructor of our plugin class. Lets thrust in advance and schedule a shortcode for our plugin. The add_shortcode() function/hook will go beneath the constructor function.
The new example of a class/object is registered using the new keyword. Refer to the final line in the code underneath.
Perceive how we’re using an array in the recall function parameter? To register recall functions within an object, we have to apply an array.

The initial thing of the array mention the object, via $this. The next thing in the array is the method name inside the class. All hooks and filters have to be mentioned like this when surrounded by a class.

Step 2 - Dribbble API Class

Ever since we at present do not need any imagine API functions, we’re going to build a rather straightforward API wrapper for Dribbble. There is by now a library obtainable for Dribbble, but, for the sake of this lecture, we’re going away to write our own possess. It’ll help you appreciate the concepts behind this lesson.
We’re available to write a DribbbleAPI object, and register a method called getPlayerShots() to interact with Dribbble’s API and return an array of the latest shots.
Let’s create a novel file for this class, called DribbbleAPI.php
Above, we’re surroundings up two class variables.
  • $apiUrl – The linkage to the Dribbble API, where the calls will be sent.
  • $user – The username or user id of a Dribbble user. This charge will be place from surrounded by the constructor (__construct) method.
The constructor is approved a $user variable, which is then approved on by the constructor to the class property, identified user.
We prefix the property, or variable name with public to identify that the value of this property can be repossess from external of the class. If we as an alternative wish to perimeter access to the property to only this class, and possibly any classes that inherit from it, we’d employ the protected prefix. This perform is passed on to as encapsulation.
We have the pedestal prepared for our Dribbble API wrapper. At the present, We’re going to inscribe a new method, called getPlayerShots(). The reason of this method will be to query the API and change the effect into an array for tradition surrounded by our plugin.
The getPlayerShots function retrieves’ the user from the class variable. It exploits WordPress’ wp_remote_get function to query the Dribbble API. The API then responds to our query with a JSON string, which is then parsed into an array and sent reverse to the function by means of the return keyword.
This is all that we need from the API at the instant – merely an array of player shots. If we happen to need more functionality in the upcoming, we can moreover add more methods to the current class, or create a new class that extends this one. Once more, this is referred to as inheritance.


Step 3 – Integrating the DribbbleAPI Class

This is the amusing part; the recently parched DribbbleAPI class will approach into use. We’re available to loop through the shots regained from the API, and produce an html list of shots, which will be approved on to the shortcode and the template tag. At some stage in the loop, the full-sized Dribbble images will be cached and saved in the plugin folder, and the thumbnails will be generated using TimThumb.


To agree on if the full images are by now stored locally, the plugin path is obligatory. Also, to produce the thumbnails with timthumb, the plugin url is obligatory. For this reason, we’ll create two class variables called pluginPath and pluginURL in our WPDribbble class, and then place their morals from inside the constructor method.

Setting PluginPath and PluginUrl

getImages() Method

Build a novel method within the WPDribbble class, called getImages.
Surrounded by a class, you can utilize generic names for functions. They will not disagreement with other plugins or WordPress’ built-in functions, since they are beneath the class namespace.
  • user – Username or User ID of Dribbble. $user will be employed when registering a novel occurrence of the DribbbleAPI class.
  • $images – Number of images to render. $images will be used when querying the API through the getPlayerShots method.
  • $width and $height – Timthumb will be employed to produce thumbnails.
  • $caption – Opportunity to turn into heading of an image.
After that, we’re available to embrace the DribbbleAPI class in the getImages() function, and create a novel occurrence of it to clutch the images.

The $shots variable in the code is inhabited with an array of three current Dribbbles from the $user.
As mentioned in advance, we’re available to loop through the $shots array, and save the chock-full size images close by for caching motivations. The cached images will be empoyed with TimThumb to provide the thumbnails. For amassing full-images and thumbnails produced by TimThumb, make two folders. We’ll utilize full-images/ for amassing the full size images, and cache/ for the thumbnails, since that is the default folder name for TimThumb.
The HTML for the list will be generated within the $shots ring.


Adding Classes

It’s always a good idea to add classes to each element of your plugin. This provides the advanced users of your plugin with the freedom to customize it. Avoid using inline CSS for content that is generated through your plugin.

Step 4 – Setting up the Shortcode

Shortcodes, as the name advocates, allows users to simply attach intricate content into blog posts.
We before now have the add_shortcode hook prepared in our plugin class constructor. Now, we’re going away to inscribe the shortcode method within our class, which will take out the shortcode attributes and come again the Dribbble images by using the getImages() method.
We’ll be calling our shortcode [Dribbble]. As declared previously, the name of the shortcode is strong-minded by the initial parameter in the add_shortcode function. It will be used with the attributes mandatory for the getImages() method. For example: [Dribbble user=haris images=5 width=100 height=100 caption=true].

Add Shortcode support for WordPress Widgets

By evade, WordPress widgets don’t sustain shortcodes, however, by using the widget_text filter, we can oblige shortcode support in WordPress widgets.
We can add the filter in our WPDribbble object constructor.

Step 5 Setting up the Template Tag

The template tag can be employed directly in WordPress themes. The essential purpose of the template tag will be to generate a novel example of our WPDribbble class, and call the getImages() method. The template tag will be a easy PHP function and it has to be registered outer surface the plugin class. It needs to contain a unique name; otherwise, it will difference with functions / plugins with similiar name. Since our plugin is entitled WP-Dribbble, we’ll entitle the template tag, wp_Dribbble().

Voila!

Congratulations! You have effectively written a WordPress plugin with OOP. If you fall in any problem, let me know, I’ll try to do my best to help you.